- LeetCode 94 – Binary Tree Inorder Traversal
Four lines recursively, which is why the statement ends with "could you do it iteratively?" — the recursion is the warm-up and the explicit stack is the question. Why the loop needs both halves of its condition, why no visited flag is required, and Morris traversal for when O(1) space is asked for.
- MySQL – Deadlocks
Two transactions each waiting for a lock the other holds. Reproducing one in two terminals so you can see it happen, reading SHOW ENGINE INNODB STATUS to find out which statements were involved, the difference between a deadlock and a lock wait timeout, gap locks and why REPEATABLE READ produces deadlocks READ COMMITTED does not, and the two fixes that actually work: consistent lock ordering, and retrying.
- LeetCode 91 – Decode Ways
Climbing Stairs with the steps made conditional, and that one change means most wrong answers come from a single character: '0'. The recurrence takes a minute; the zeros take the rest of the interview. Why the two-digit gate needs a LOWER bound of 10, and why ways(0) must be 1.
- LeetCode 88 – Merge Sorted Array
Tagged Easy, with one idea worth more than most Mediums: when you write into an array you are also reading, go backwards. The trailing zeros are reserved space rather than data, forwards clobbers values it has not consumed, and looping on nums2 alone is what makes the remainder handle itself.
- LeetCode 83 – Remove Duplicates from Sorted List
Five lines with one bug in them that nearly everyone writes first: advancing after a deletion skips the node that just became the successor, and only three equal values in a row exposes it. Also the cleanest place to learn when a linked list needs a dummy head — exactly when the head itself can be removed.