leetcode——242. 有效的字母异位词

做不动了,就做点简单题调节一下。

class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        if len(s)!=len(t):
            return False
        a=set(s)
        for i in a:
            if i not in t or s.count(i)!=t.count(i):
                return False
        return True
执行用时 :44 ms, 在所有 python3 提交中击败了99.19%的用户
内存消耗 :14.2 MB, 在所有 python3 提交中击败了10.35%的用户
 
                                                      ——2019.10.16
posted @ 2019-10-16 21:26  欣姐姐  阅读(131)  评论(0编辑  收藏  举报