dsa · medium

Single Number III

Exactly two values in nums appear **once**. Every other value appears **twice**. Return the two unique values in any order.

Arguments

Example

nums = [1,2,1,3,2,5][3,5] (or [5,3]).

nums = [-1,0][-1,0].

Constraints

2 <= nums.length <= 5 * 10^4 -2^31 <= nums[i] <= 2^31 - 1 exactly two values appear once; every other value appears twice Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
[1, 2, 1, 3, 2, 5]

Expected:
[3,5]

Example 2

Input:
[-1, 0]

Expected:
[-1,0]

Example 3

Input:
[0, 1]

Expected:
[1,0]

Open in the Dojo editor