Skip to content

Instantly share code, notes, and snippets.

@tamlt2704
Created December 31, 2017 11:38
Show Gist options
  • Select an option

  • Save tamlt2704/71ddfd95705e0de193bac088e05e35a0 to your computer and use it in GitHub Desktop.

Select an option

Save tamlt2704/71ddfd95705e0de193bac088e05e35a0 to your computer and use it in GitHub Desktop.
# https://leetcode.com/problems/find-the-difference/description/
# aka: remove all duplicated elements
# idea: a XOR a = 0
class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
return chr(reduce(operator.xor, map(ord, s + t)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment