Simple Python Solution


  • 2
    I
    class Solution(object):
        def findTheDifference(self, s, t):
            """
            :type s: str
            :type t: str
            :rtype: str
            """
            for ch in t:
                if (s+t).count(ch)%2:
                    return ch;
    

  • 0
    V

    The method is very cool.


  • 0
    J

    Very interesting idea, however this would repeatedly look at the same letters .. i.e. the e below.
    'eeeeeeeeeeeeeeeeaa'
    'eeeeeeeeeeeeeeeeaab'


Log in to reply
 

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