- Scaling the Database
The order to do things in, because most systems reach for sharding several steps too early. Indexes and query plans, connection pooling, read replicas and the replica lag that breaks read-your-writes, vertical against horizontal, partitioning versus sharding, choosing a shard key you will not regret, hot shards, and what resharding actually costs once you are live.
- LeetCode 15 – 3Sum
The problem that teaches sort-then-two-pointers. The algorithm is the easy half; the half that decides whether you pass is de-duplication, and there are two separate places a duplicate gets in. Why sorting buys three things at once, why the anchor skip must compare backwards, and why no solution can beat O(n²) when the output itself can hold that many triplets.
- LeetCode 14 – Longest Common Prefix
A five-minute problem whose only real content is the edge cases. Scanning vertically — one character position down the whole array before moving right — is shorter than the horizontal version, exits at the first mismatched column, and makes the bounds check handle both short strings and empty ones in a single line. Plus the sorting trick, and why it is the worse answer.
- Caching – Patterns, Invalidation and What Breaks
A cache-aside read on a real endpoint, measured cold and warm, then everything that makes caching hard rather than easy. Write-through against write-behind, TTL and eviction policies, the two invalidation strategies and why you want both, cache stampede and how to stop it, and the rule that decides whether a cache is an optimisation or a new single point of failure.
- LeetCode 13 – Roman to Integer
The inverse of Integer to Roman, and the trick that solved that one does not transfer. Going this way, all six subtractive pairs are handled by a single comparison: if a symbol is smaller than the one after it, subtract it. No table of pairs, no lookahead bookkeeping, and you never need to recognise CM as a unit. Java and Python, plus why not to rebuild a HashMap on every call.