- 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.
- LeetCode 149 – Max Points on a Line
A Hard problem whose algorithm is trivial and whose difficulty is entirely how you represent a slope. Floating point is unsound as a hash key and fails silently on large coordinates; an unreduced pair splits equal slopes; a reduced pair without a sign convention splits opposite directions.