Title Description
Please find a longest common string does not contain repeating characters from a string, we calculate the length of the longest substring.
Thinking
Code
class Solution:
def lengthOfLongestSubstring(self,s):
result = 0
low = 0
for high in range(len(s)):
if s[high] not in s[low:high]:
result = max(high-low+1,result)
else:
while s[high] in s[low:high]:
low += 1
return result