Recover a Signed Value among Threefold Repetitions
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
### Problem
Every value in `nums` appears exactly three times except one value that appears once. Return that value. Your solution must take linear time and constant extra space.
```cpp
int singleNumber(vector<int>& nums);
```
### Examples
```text
Input: nums = [6,-4,6,6]
Output: -4
```
```text
Input: nums = [0,-2147483648,0,0]
Output: -2147483648
```
### Constraints
- Length is between 1 and 30000.
- Every value fits a signed 32-bit integer, including -2147483648.
- The once/three-times frequency guarantee holds exactly.
Overview: Recover a unique signed 32-bit value among triples by fixed-width bit counts modulo three.