Simple Python solution


  • 0
    class Solution(object):
        def findTheDifference(self, s, t):
            s = sorted(s)
            t = sorted(t)
            for i in xrange(len(s)):
                if not s[i]==t[i]:
                    return t[i]
            return t[-1]
    

Log in to reply
 

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