有效的字母异位词
给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。
重要代码: arr[ord(i)-ord(‘a’)]+=1
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
arr=[0]*26
for i in s:
arr[ord(i)-ord('a')]+=1
for i in t:
arr[ord(i)-ord('a')]-=1
for i in arr:
if i!=0:
return False
return True