Simple Python Solution


  • 0
    R

    '''

        a=list(ransomNote) # convert strings to lists
        b=list(magazine)
        for i in a:
            if i in b:    # Check if letter in magazine list
                b.pop(b.index(i)) # Pop letter from magazine
            else:
                return False
        return True
    

    '''


Log in to reply
 

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