- Consistency, Availability and CAP
CAP without the folklore — what the theorem says, what it does not say, and why PACELC is the more useful version day to day. Strong against eventual consistency, read-your-writes and monotonic reads, quorums, and the dual-write problem that appears the moment a second datastore enters the design. Shown against a live Postgres-to-Elasticsearch sink, including exactly where it goes wrong.
- LeetCode 21 – Merge Two Sorted Lists
The merge step of merge sort, isolated. Worth writing carefully rather than quickly, because Merge k Sorted Lists calls it and so does sorting a linked list. The part people over-engineer: splice the remaining list on in a single assignment instead of looping it out. Why the space is O(1), and why <= rather than < is the detail that shows you were thinking.
- LeetCode 20 – Valid Parentheses
The canonical 'you should have reached for a stack' problem. Nesting means the thing you must close next is the thing you opened most recently. The trick that shortens the code: push the closer you expect, not the opener, so the check becomes one equality test. Three failure modes, three checks — and why ArrayDeque beats the legacy Stack.
- LeetCode 19 – Remove Nth Node From End of List
You cannot walk a singly linked list backwards, so the nth node from the end has to be found from the front. Two pointers held a fixed distance apart do it in one pass — but the gap is n + 1, not n, because unlinking a node needs the node before it. Why the dummy head is not optional here, and an honest note on what 'one pass' actually buys.
- 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.