Submission Detail

987 / 987 test cases passed.
Status:

Accepted

Runtime: 5058 ms
Memory Usage: 15.2 MB
Submitted: 2 weeks, 1 day ago
loading
Runtime Error Message:
Last executed input:
Input:
Output:
Expected:

Accepted Solutions Runtime Distribution

500
1000
1500
2000
2500
3000
3500
1.0
2.0
3.0
4.0
python
Runtime (ms)
Distribution (%)

500
1000
1500
2000
2500
3000
3500
1
2
3
4
Zoom area by dragging across this chart

Accepted Solutions Memory Distribution

13000
13250
13500
13750
14000
14250
14500
14750
15000
5
10
15
python
Memory (KB)
Distribution (%)

13000
13250
13500
13750
14000
14250
14500
14750
15000
5
10
15
Zoom area by dragging across this chart

Invite friends to challenge Longest Substring Without Repeating Characters


Submitted Code: 2 weeks, 1 day 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
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
seen = []
count = 0
max = 1
if (not s):
return 0
for i in range(0,len(s)):
count = 0
seen.append(s[i])
count += 1
for j in range(i+1,len(s)):
if (s[i] != s[j] and s[j] not in seen):
count += 1
seen.append(s[j])
if (count > max):
max = count
else:
seen = []
count = 0
i = j
break
return max
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX