Intersting Python Solution


  • 1

    '''
    class Solution(object):
    def findTheDifference(self, s, t):
    """
    :type s: str
    :type t: str
    :rtype: str
    """
    result1 = 0
    result2 = 0
    for i in range(len(s)):
    result1 += ord(s[i])
    for i in range(len(t)):
    result2 += ord(t[i])
    return chr(result2-result1)
    '''
    Sum up the str ASCII value, convert the difference back to chr.


Log in to reply
 

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