dsa · medium

Single Number II

Every value in nums appears **three times**, except one value that appears **once**. Return that unique value.

Arguments

Example

nums = [2,2,3,2]3.

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

Constraints

1 <= nums.length <= 5 * 10^4 -2^31 <= nums[i] <= 2^31 - 1 every value appears three times except one value that appears once Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
[2, 2, 3, 2]

Expected:
3

Example 2

Input:
[0, 1, 0, 1, 0, 1, 99]

Expected:
99

Open in the Dojo editor