continuous imprv.
This commit is contained in:
parent
b24dd672a8
commit
766faa4850
@ -4,8 +4,8 @@
|
|||||||
# longest substring without repeating characters
|
# longest substring without repeating characters
|
||||||
|
|
||||||
def solution(s: str) -> int:
|
def solution(s: str) -> int:
|
||||||
if len(s) == 0:
|
if len(s) <= 1:
|
||||||
return 0
|
return len(s)
|
||||||
|
|
||||||
longest = -1
|
longest = -1
|
||||||
|
|
||||||
@ -21,7 +21,6 @@ def solution(s: str) -> int:
|
|||||||
for t in range(f+1, len(s)):
|
for t in range(f+1, len(s)):
|
||||||
cs = count(s[f:t+1])
|
cs = count(s[f:t+1])
|
||||||
longest = cs if cs > longest else longest
|
longest = cs if cs > longest else longest
|
||||||
longest = 1 if longest < 1 else longest
|
|
||||||
|
|
||||||
return longest
|
return longest
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user