continuous imprv.

This commit is contained in:
yigid balaban 2024-09-11 19:02:26 +03:00
parent b24dd672a8
commit 766faa4850
Signed by: fyb
GPG Key ID: E21FEB2C244CB7EB

View File

@ -4,8 +4,8 @@
# longest substring without repeating characters
def solution(s: str) -> int:
if len(s) == 0:
return 0
if len(s) <= 1:
return len(s)
longest = -1
@ -21,7 +21,6 @@ def solution(s: str) -> int:
for t in range(f+1, len(s)):
cs = count(s[f:t+1])
longest = cs if cs > longest else longest
longest = 1 if longest < 1 else longest
return longest