One idea at a time
Learn
Clear explanations for the ideas engineers keep meeting. Follow the reasoning, explore the mechanism, and build intuition you can use.
Why dynamic programming is hard — and how to recognise it
Dynamic programming is hard: its cache key must capture every fact that changes the future. Drive this recurrence to find the right state — and reject fake DP.
Why race conditions are so hard to debug
Race conditions are hard to debug: each request can look correct in isolation. Drive two sign-ups to see an invariant fail between check and insert.
The widest reservoir
Two walls hold water between them. Checking every pair is O(n²). Moving inward from both ends finds the same answer in one pass.
Rotate a matrix 90° with no second grid
A rotation looks like it needs somewhere to put the answer. It does not: two reflections, 45° apart, do the whole job in place.
Partitioning vs sharding
Both split a table into pieces. Only one of them puts the pieces on different machines, and everything hard about sharding falls out of that.
How a database survives being unplugged mid-write
The trick is not writing faster. It is writing the intention down somewhere durable before touching the data at all.