Approach Summary
Sum bits at each position modulo 3. The bit that does not cancel is the unique number's bit. Use two variables (ones, twos) for a clean state machine.
How to Recognize This Pattern
- Every element appears 3× except one
- Bit-count mod 3 at each position — 32 separate counters or state machine
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(1)
Tags
Array Bit Manipulation