short python solution


  • 0
    G
    from collections import Counter
    class Solution(object):
        def findTheDifference(self, s, t):
            """
            :type s: str
            :type t: str
            :rtype: str
            """
            d=Counter(s)
            for i in t:
                if i not in d:
                    return i
                if not d[i]:
                    return i
                d[i]-=1
            
    

Log in to reply
 

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