Bit Manipulation Techniques
Use binary operations for speed and compact state.
Intermediate
x & (x-1) clears the lowest set bit; x & -x isolates it; check power of two with x and not (x & (x-1)); XOR finds the unique element.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.