my python


  • 0
    H
    class Solution(object):
        def isAnagram(self,s,t):
            """
            :param s: str
            :param t: str
            :return: bool
            """
            if len(s) != len(t):
                return False
            sd,td = {},{}
            for i in s:
                sd[i] = sd.get(i,0)+1
            for j in t:
                td[j] = td.get(j,0)+1
            return sd == td
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.