```
class Solution(object):
def singleNumber(self, nums):
from operator import xor
a_xor_b = reduce(xor, nums)
k = 0
tmp = a_xor_b
while tmp & 1 == 0:
k += 1
tmp >>= 1
a = reduce(xor, (n for n in nums if (n >> k) & 1 == 1))
return [a, a_xor_b ^ a]
```