Algorithms from zero
Problem-solving toolbox: interview drill
You understand the bit tricks and the in-place matrix moves. Interviews test whether you can reach for XOR or a transpose-then-reverse under a timer, and explain why the trick is correct out loud.
Solve each problem before you reveal a hint, hit the target time, and narrate the time and space complexity as if an interviewer were listening. The hints exist for when you are genuinely stuck — they nudge you toward the pattern, never the full solution.
Five NeetCode-150 problems on the math-geometry and bit-manipulation patterns this unit teaches. Set a timer, solve each cold without looking at a hint, then say the time and space complexity out loud before you move on. Reveal a hint only when you are truly stuck — the hints nudge, they never hand you the answer.
0/5 solved
math geometry
Follow-up (aloud)
Why does transpose-then-reverse-rows equal a clockwise rotation? What changes if you wanted counter-clockwise instead?
Follow-up (aloud)
Where exactly do you re-check the bounds to avoid emitting a row or column twice on a non-square matrix?
bit manipulation
Follow-up (aloud)
Why is the n & (n - 1) loop O(number of set bits) rather than O(32)? When does that actually matter?
Follow-up (aloud)
Both bits[i >> 1] + (i & 1) and bits[i & (i - 1)] + 1 work. Explain what each recurrence is really saying about the bits of i.
Follow-up (aloud)
Why do XOR's commutativity and associativity make the pairing cancellation order-independent? What if every element appeared three times instead of two?
Mark each problem solved once you finished it cold, inside the target time, and could state the complexity without hesitation. Come back in a few days and re-solve the ones you marked — spaced revisits are what turn a recognised pattern into a reflex.