- LeetCode 36 – Valid Sudoku
No algorithm at all — a bookkeeping problem. Rows, columns and all nine boxes can be checked in a single pass, and the only interesting line is the formula mapping a cell to its box: (row / 3) * 3 + col / 3. Encoding three facts per cell into one set, why valid is not the same as solvable, and the bitmask version for when you are asked to drop the hashing.
- MySQL – LIKE and Pattern Matching
Matching text patterns. The `%` and `_` wildcards, ESCAPE for matching a literal percent sign, why LIKE is case-insensitive here and what the column's collation has to do with it, NOT LIKE, REGEXP when LIKE is not enough, and the performance rule worth remembering: `LIKE 'Pep%'` can use an index and `LIKE '%roni'` cannot.
- AWS – Load Balancers: ALB, NLB and Target Groups
ALB or NLB, decided in one table instead of three paragraphs. The target group is the object that actually matters and the health check on it is what decides whether your deploy is a deploy or an outage — including the arithmetic that turns a 30-second interval into a two-and-a-half minute outage. Path and host routing rules, sticky sessions and why you probably do not want them, and draining connections.
- MySQL – BETWEEN
BETWEEN as shorthand for two comparisons, and the two things that catch people out: it is inclusive at both ends, and on a DATETIME column `BETWEEN '2024-01-01' AND '2024-01-31'` silently drops almost the whole of the 31st. NOT BETWEEN, BETWEEN on strings, and the half-open `>= ... < ...` form that is the right answer for dates.
- LeetCode 34 – Find First and Last Position of Element in Sorted Array
Plain binary search finds an occurrence; this wants the first and the last, and expanding outwards from a hit is O(n) the moment the array is all one value. The clean answer is one primitive — lower bound — called twice, with target + 1 giving the second answer. Why the window is half-open, and why removing the equality test removes the bugs.