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
我的前方是万里征途,星辰大海!!
原文地址:https://www.cnblogs.com/taoyuxin/p/11688579.html