Submission Detail

73 / 73 test cases passed.
Status:

Accepted

Runtime: 457 ms
Memory Usage: 24.9 MB
Submitted: 0 minutes ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

400
600
800
1000
1200
1400
1600
1800
0.2
0.4
0.6
0.8
1.0
python
You are here!
Your runtime beats 50.77 % of python submissions.
Runtime (ms)
Distribution (%)

400
600
800
1000
1200
1400
1600
1800
0.5
1.0
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

23000
24000
25000
26000
27000
28000
29000
30000
31000
32000
33000
34000
35000
5
10
15
20
25
python
You are here!
Your memory usage beats 90.63 % of python submissions.
Memory (KB)
Distribution (%)

23000
24000
25000
26000
27000
28000
29000
30000
31000
32000
33000
34000
35000
10
20
Zoom area by dragging across this chart

Invite friends to challenge Longest Consecutive Sequence


Submitted Code: 0 minutes ago

Language: python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Solution(object):
def longestConsecutive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if (len(nums) == 0):
return 0
nums.sort()
i = 0
count = 1
max = 1
while (i < len(nums)-1):
if (nums[i+1] == nums[i]):
i += 1
continue
if (nums[i+1] == nums[i] + 1):
count += 1
else:
if (count > max):
max = count
count = 1
i += 1
if (count > max):
max = count
return max
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX