Find the Difference
Input:
s = "abcd"
t = "abcde"
Output:
e
Explanation:
'e' is the letter that was added.1. XOR
class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
result = 0
for i in s+t:
result ^= ord(i)
return chr(result)Last updated