Simple and Easy to Understand Python Solution


  • 0
    L

    Simple and easy to understand

    '''

        if len(s) != len(t):
            return False
        for i in set(t):
            if t.count(i) > s.count(i):
                return False
        return True
    

    '''
    The first if statement is to eliminate the length difference case. The for loop is to count the different letters in the string.


Log in to reply
 

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