- LeetCode 189 – Rotate Array
The array version of Reverse Words in a String, using the identical three-reversal trick. It is also where forgetting k %= n turns a correct algorithm into an exception, and where the Python one-liner rebinds a local name so the caller sees nothing at all.
- LeetCode 173 – Binary Search Tree Iterator
Inorder traversal split across two methods, and that is the whole insight — the descend-left loop becomes the advance step and the stack becomes the object's state. Plus the amortised argument that makes next() O(1) on average when a single call can clearly do O(h) work.
- LeetCode 170 – Two Sum III – Data Structure Design
Not an algorithms problem — a question about which operation gets called more often. Two designs with opposite costs, and the answer the interviewer wants is the sentence that chooses between them. Plus why it must count rather than use a set: find(4) after one add(2) is false.
- MongoDB – Indexes and the ESR Rule
Single, compound, multikey, unique and partial indexes, the field order that makes them work, and how to read explain().
- LeetCode 169 – Majority Element
Boyer-Moore voting is four lines that look like they cannot be correct, and the counting argument is short enough to give out loud: every disagreement cancels a pair, and a strict majority cannot be exhausted. The algorithm does not find the majority — it eliminates everything that cannot be it.