- MongoDB – Query Operators
Comparison, logical, element and array operators, plus projection — the vocabulary every later query is built from.
- LeetCode 114 – Flatten Binary Tree to Linked List
The best problem on the list for the idea that pointer surgery can replace a data structure. Three solutions using O(n), O(h) and O(1) space — the last one splices the right subtree onto the left subtree's rightmost node, which is Morris threading kept rather than undone.
- 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.