Python one line beats 99.15%


  • 2
    P

    class Solution(object):
    def isAnagram(self, s, t):
    """
    :type s: str
    :type t: str
    :rtype: bool
    """

        return all(s.count(x) == t.count(x) for x in 'abcdefghijklmnopqrstuvwxzy')

Log in to reply
 

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