We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 703ea5d commit 452ac8fCopy full SHA for 452ac8f
Arrays/Easy/Single Number.py
@@ -1,5 +1,8 @@
1
class Solution:
2
def singleNumber(self, nums: List[int]) -> int:
3
+ #hashmap
4
+ #math -> 2 * (a+b+c) - (a+a+b+b+c) = c
5
+ #bitmasking -> a^0 = a and a^a = 0; a^b^a = a^a^b = 0^b = b
6
a = 0
7
for i in nums:
8
a ^= i
0 commit comments