one pass python solution

  • 1
    class Solution(object):
        def findTheDifference(self, s, t):
            :type s: str
            :type t: str
            :rtype: str
            k = 0
            for i in range(len(s)):
                k -= ord(s[i])
                k += ord(t[i])
            return chr(k)

Log in to reply

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