遍历字符串
使用字典记录所遇到的所有字符
若后续遇见的字符在字典中
break并返回False
否则返回True
class Solution:
def isUnique(self, astr: str) -> bool:
thisdict = {}
for letter in astr:
if letter not in thisdict:
thisdict[letter] = 1
else:
return False
return True