2020/9/19
242 有效的字母异位词
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
charmap1=self.getCharMap(s)
charmap2=self.getCharMap(t)
if(charmap1==charmap2):
return True
else:
return False
# if(charmap1.keys()!=charmap2.keys()):
# return False
# else:
# for key in charmap1.keys():
# if(charmap1[key]!=charmap2[key]):
# return False
# return True
def getCharMap(self,s:str)->map:
charmap={
}
for char in s:
if char in charmap.keys():
charmap[char]+=1
else:
charmap[char]=1
return charmap
409. 最长回文串
class Solution:
def longestPalindrome(self, s