Created
December 31, 2017 11:38
-
-
Save tamlt2704/71ddfd95705e0de193bac088e05e35a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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