Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def singleNumber(self, nums: List[int]) -> List[int]:
- nums_xor = reduce(xor, nums)
- single_set_bit = (-nums_xor) & nums_xor
- num1 = reduce(xor, (n for n in nums if (n & single_set_bit)))
- num2 = nums_xor ^ num1
- return [num1, num2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement