Submission Detail

54 / 54 test cases passed.
Status:

Accepted

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

Accepted Solutions Runtime Distribution

450
500
550
600
650
700
750
0.5
1.0
1.5
2.0
2.5
python
You are here!
Your runtime beats 9.23 % of python submissions.
Runtime (ms)
Distribution (%)

450
500
550
600
650
700
750
1.0
2.0
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

22000
23000
24000
25000
26000
27000
28000
29000
30000
31000
32000
2.5
5.0
7.5
10.0
12.5
15.0
python
Memory (KB)
Distribution (%)

22000
23000
24000
25000
26000
27000
28000
29000
30000
31000
32000
5
10
15
Zoom area by dragging across this chart

Invite friends to challenge Contains Duplicate II


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
class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
values = {}
for i in range(0,len(nums)):
if (nums[i] not in values):
values[nums[i]] = [i]
else:
for ind in values[nums[i]]:
if (abs(ind - i) <= k):
return True
values[nums[i]].append(i)
# print(values)
return False
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX