Find the Two Unique Numbers
Problem statement
You are given an integer array nums. Exactly two values appear once, while every other value appears exactly twice.
Return the two unique values in ascending order.
Function
findTwoUniqueNumbers(nums: int[]) → int[]Examples
Example 1
nums = [1,2,1,3,2,5]return = [3,5]The paired values cancel, leaving 3 and 5.
Example 2
nums = [-4,7,-4,9,7,-2]return = [-2,9]Only -2 and 9 occur once; the result is sorted.
Constraints
2 <= nums.length <= 100000-1000000000 <= nums[i] <= 1000000000- Exactly two values appear once, and every other value appears exactly twice.