Download Find the Difference.py
class Solution(object): def findTheDifference(self, s, t): """ :type s: str :type t: str :rtype: str """ res = ord(t[-1]) for i in range(len(s)): res += ord(t[i]) res -= ord(s[i]) return chr(res) # def findTheDifference(self, s, t): # res = 0 # for c in s + t: # res ^= ord(c) # return chr(res)
Leetcode 389 Find the Difference problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.