This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingConcept theory, tags and interview notes for Count set bits · power of two · single number.
What this asks
Three classic bit checks on one input: count the set bits, decide whether the number is a power of two, and find the unpaired value.
x & (x - 1) drives the count and the power test; a running XOR drives the single number.
Try the matching visualizer modeThe full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing