Info
This question is expected to use the fact that you only use the ascii 26 letters
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
sDict = dict()
tDict = dict()
for c in s:
if c in sDict.keys():
sDict[c] += 1
else:
sDict[c] = 1
for c in t:
if c in tDict.keys():
tDict[c] += 1
else:
tDict[c] = 1
if len(sDict.keys()) != len(tDict.keys()):
return False
for c in sDict.keys():
if (c not in tDict.keys()) or (tDict[c] != sDict[c]):
return False
return True