Hardware interview practice
Find the single non-duplicate
Every integer in an array appears exactly twice except one. Return the value that appears once.
Reviewed example
Work through one case
Input
values = [4, 1, 2, 1, 2]Expected output
4Equal values cancel under XOR, leaving the value that appears only once.
What to cover
Requirements
- Use constant extra space.
- Do not sort the input.
- Assume exactly one singleton exists.
