- LeetCode 28 – Implement strStr()
Reimplement indexOf. The honest answer to 'do I need to write KMP?' is almost always no — the interviewer wants a clean nested loop with correct bounds, and the bounds are the entire problem. Why i <= n - m is not a typo, how it handles a too-long needle for free, why not to allocate a substring per position, and how to raise KMP without walking into it.
- Concurrency – Double Booking and Distributed Locks
Two guests, one room, the same millisecond. Why the check-then-write everyone writes first is always wrong, optimistic against pessimistic locking, the database constraints that make a race impossible rather than unlikely, idempotency keys for requests that must not run twice, and distributed locks — what they cost, how they fail, and why they belong last on the list rather than first.
- LeetCode 23 – Merge k Sorted Lists
Merging two lists is solved; the question is in what order you merge k of them, and the obvious order costs a factor of k. Where that extra factor comes from, why pairwise merging gets it to O(N log k), and an honest comparison of divide-and-conquer against a min-heap — same time, different space, and only one of them survives the streaming follow-up.
- Message Queues and Asynchronous Work
Why the line after a commit is the most dangerous line in the file, and what to do about it. Queues against logs, at-least-once delivery and the idempotency it forces, the transactional outbox, retries with exponential backoff, dead-letter queues, and how a worker claims work without two workers doing it twice. Every piece taken from a queue that runs, including the duplicate it produced.
- LeetCode 22 – Generate Parentheses
The problem that teaches constrained backtracking. The lazy solution builds all 4^n bracket strings and filters; the intended one never builds an invalid string, because two small rules make it impossible. Why close < open is sufficient — not just true — the undo step everyone forgets, and why the output being Catalan-sized bounds any possible solution.