We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
XOR cancels pairs, which makes single-number problems collapse to a one-line scan, and n & (n-1) clears the lowest set bit, which powers most bit-counting solutions. These are pattern-recognition problems: you either know the identity or you do not, so the return on memorising the handful that recur is unusually high. Expect at least one in a screening round at hardware-adjacent companies.
"Appears once/twice", powers of two, or an explicit O(1) space requirement.
11 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.