Given an integer array nums where exactly two elements appear once and all the other elements appear twice, return the two elements that appear once. Pattern focus: XOR Trick. XOR everything first, then use a distinguishing bit to split the numbers into two groups.
nums = integer array with exactly two unique elements
the two unique numbers
Example 1:
Input:
nums = [1,2,1,3,2,5]
Output:
[3,5]
Explanation:
The two numbers that appear once are 3 and 5.
Example 2:
Input:
nums = [4,1,2,1,2,5]
Output:
[4,5]
Explanation:
The two unique numbers are 4 and 5.