Pattern Recognition Drill
Easy Bit Manipulation
The Problem
Count positions where corresponding bits of two integers differ.
What approach would you use?
Think about it before scrolling down.
XOR a and b, count set bits in the result. Combines XOR + Kernighan's trick. O(1).
Common Trap
This is a two-step pattern: XOR to find differences, then count bits.