Python easy solution with ord() and chr()

  • 1
    class Solution(object):
        def findTheDifference(self, s, t):
            :type s: str
            :type t: str
            :rtype: str
            r = 0
            for c in t: r += ord(c)
            for c in s: r -= ord(c)
            return chr(r)

Log in to reply

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