题目描述
blablabla
样例
blablabla
算法1
代码
class Solution:
def longestSubstringWithoutDuplication(self, s):
"""
:type s: str
:rtype: int
"""
if not s:
return 0
l = 1
sub = s[0]
for i in s[1:]:
if i in sub:
index = sub.find(i)
sub = sub[index+1:]
sub = sub + i
if l<len(sub):
l = len(sub)
return l