Created
October 4, 2019 06:12
-
-
Save sudoankit/9c8c2feaaca140f301d4be6dfc61bb68 to your computer and use it in GitHub Desktop.
Number Occurring Odd Number of Times in O(n) using hash table
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
def find_it(seq): | |
hash = 0 | |
for i in seq: | |
hash = hash ^ i # bitwise XOR | |
return hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment