DescriptionQ1027
Q1027FWASIC interview problem
Find the single non-duplicate
TechniquesBitsXOR
DifficultyEasy
TopicBit Manipulation
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Every integer in an array appears exactly twice except one. Return the value that appears once.
Example input and output
Use this case to check your interpretationInput
values = [4, 1, 2, 1, 2]Output
4Explanation
Equal values cancel under XOR, leaving the value that appears only once.
02
Requirements (3)
- Use constant extra space.
- Do not sort the input.
- Assume exactly one singleton exists.
