import collections
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
s_dic = collections.Counter(s)
t_dic = collections.Counter(t)
if s_dic == t_dic:
return True
return False
【leetcode】242. 有效的字母异位词 (python)
最新推荐文章于 2024-08-14 20:55:52 发布