- LeetCode 156 – Binary Tree Upside Down
Pure pointer surgery with no search and no complexity to argue about. The whole problem is doing four assignments in an order that does not destroy what the next one needs — null out root.left before reading it and the subtree is gone. Both pointers must be nulled, not just one.
- LeetCode 152 – Maximum Product Subarray
Kadane with multiplication, and the change is bigger than it looks: a large negative is not a bad prefix, it is a latent good one waiting for another negative. Carry the minimum as well as the maximum, and watch the assignment order — curMin needs the OLD curMax.
- MongoDB – Schema Validation
$jsonSchema, validation levels and actions — and why a flexible store still wants rules at the boundary.
- LeetCode 151 – Reverse Words in a String
One line in Python and a real exercise in Java, which is what makes it a good question. Reverse the whole string, then reverse each word back — the first pass fixes the order and breaks the spelling, the second fixes the spelling without moving anything. The spaces are the fiddly part.
- MySQL – Running Queries in Production Safely
The habits that keep an ad-hoc query from becoming an incident. Reading before writing, wrapping a change in a transaction you can roll back, sql_safe_updates, always EXPLAIN before running something new against a big table, deleting and updating in batches, MAX_EXECUTION_TIME, finding and killing a runaway query with SHOW PROCESSLIST, the slow query log, and why a long ALTER TABLE needs a plan.