error info is NameError; fun judgeString is not found.so I would like to ask .
could I define another function in Solution
class Solution:
def judgeString(subString):
strSet = set()#不要这样使用,还以为是dict
for c in subString:
if c not in strSet:
strSet.add(c)
else:
return False
return True
def lengthOfLongestSubstring(self, s):
max_ = 0
temp_ = 0
for i in range(0,len(s)):
for j in range(i,len(s)+1):
if i == 0 and j == len(s):
pass
else:
if judgeString(s[i:j]):
temp_ = len(s[i:j])
max_ = temp_ if temp_ > max_ else max_
return max_