Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in **any order**. You must write an algorithm that runs in linear runtime complexity and uses only constant extra space.
Example 1
Input: nums = [1,2,1,3,2,5]
Output: [3,5]
Explanation: 1 and 2 each appear twice, while 3 and 5 appear once, so the answer is [3,5] (in any order).
Example 2
Input: nums = [-1,0]
Output: [-1,0]
Explanation: Both values are unique, so they are the answer.
Example 3
Input: nums = [0,1]
Output: [0,1]
Explanation: Both 0 and 1 appear once, so both are returned.
XOR of everything cancels the pairs and leaves x ^ y, where x and y are the two singletons. Any set bit of that XOR is a bit where x and y differ, so partition all numbers by that bit into two groups — each singleton lands in a different group, and XOR within each group recovers it.
Run checks all cases above. Submit evaluates all test cases.