- LeetCode 112 – Path Sum
A three-line recursion containing a base case almost everyone writes wrong. Returning targetSum == 0 at a null accepts a path that stops at a non-leaf, and it passes the examples while failing on a four-node tree. Null is not a leaf. Plus why negative values kill the obvious pruning.
- LeetCode 111 – Minimum Depth of Binary Tree
The payoff for the trap set in problem 104: swapping max for min is wrong, because a node with one child is not a leaf and its missing side still reports zero. A missing child is infinity, not zero — and this is where BFS genuinely beats DFS, since it can stop at the first leaf.
- LeetCode 110 – Balanced Binary Tree
A correct answer most people write and a better one the same length. The gap is one idea: make the return value carry two things. Heights are never negative, so -1 is a free sentinel for "unbalanced" — and that turns O(n log n) into O(n) with an early exit for free.
- MySQL – Stored Procedures and Functions
Code that lives in the database. DELIMITER and why you need it, CREATE PROCEDURE, IN / OUT / INOUT parameters, variables, IF and CASE, WHILE and REPEAT loops, cursors and the handler that stops one looping forever, stored functions and how they differ from procedures, error handling with DECLARE ... HANDLER, and an honest look at when to put logic here rather than in the application.
- LeetCode 105 – Construct Binary Tree from Preorder and Inorder Traversal
The problem that makes traversal orders click: preorder tells you the root, inorder tells you the split. Why the hash map is what makes it O(n), why slicing arrays quietly reintroduces the quadratic, why the left subtree must be built first, and why preorder plus postorder is not enough.