Return the maximum depth (number of nodes along the longest root-to-leaf path) of a binary tree.
Recursive tree thinking: solve a node in terms of its children.
Depth of a node = 1 + max(depth(left), depth(right)); an empty subtree is 0. This 'answer for me = combine answers of my children' recursion is the heart of nearly every tree problem — you trust the recursive call to return the right subresult and just describe how to merge. The base case (null → 0) is what stops the recursion and seeds the arithmetic. Space is O(h) for the call stack: O(log n) for a balanced tree, but O(n) for a degenerate (linked-list-shaped) one — worth stating when asked about worst case.
Any tree aggregate (height, sum, diameter, 'does a path exist') → recurse into children and combine.
Time O(n) · Space O(h) recursion (h = height)