Python using set


  • 0
    T
    
            if (set(s)==set(t)):
                for word in s:
                    if(t.count(word)==s.count(word)+1):
                        return word
                        break
            else:
                return list(set(s)^set(t))[0]
    

    I believe there'll be someone who can improve it.


Log in to reply
 

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