Submission Detail

30 / 30 test cases passed.
Status:

Accepted

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

Accepted Solutions Runtime Distribution

0
5
10
15
20
25
30
35
2.5
5.0
7.5
10.0
12.5
15.0
python
You are here!
Your runtime beats 28.39 % of python submissions.
Runtime (ms)
Distribution (%)

0
5
10
15
20
25
30
35
5
10
15
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

13300
13100
13150
13200
13250
13350
13400
13450
13500
10
20
30
40
python
You are here!
Your memory usage beats 32.84 % of python submissions.
Memory (KB)
Distribution (%)

13300
13100
13150
13200
13250
13350
13400
13450
13500
10
20
30
40
Zoom area by dragging across this chart

Invite friends to challenge Summary Ranges


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
32
33
34
35
36
37
38
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
ranges = []
item = ""
if (len(nums) == 0):
return ""
number = nums[0]
start = nums[0]
end = nums[0]
counter = 0
for i in range(0,len(nums)):
if (i == len(nums)-1 and counter == 0):
ranges.append(str(nums[i]))
break
if (i == len(nums)-1 and counter > 0):
ranges.append(str(start) + "->" + str(nums[i]))
break
if (nums[i+1] == nums[i]+1):
counter += 1
continue
else:
end = nums[i]
if (counter > 0):
item = str(start) + "->" + str(end)
else:
item = str(start)
ranges.append(item)
start = nums[i+1]
counter = 0
print(ranges)
return ranges
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX