260. Single Number III

Practice Single Number III for free on NudgeCode: Medium, Bit Manipulation pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

In nums, exactly two distinct values appear once each and every other value appears exactly twice. Return the two values that appear once, in any order. Values are signed 32-bit integers and may be negative. Aim for O(n) time and O(1) extra space.

Example

nums = [1,2,1,3,2,5]  ->  [3,5]   ([5,3] is also accepted)
nums = [-1,0]         ->  [-1,0]

Constraints