Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example Tree:
3
/ \
9 20
/ \
15 7
Maximum depth: 3 (path: 3 -> 20 -> 15 or 3 -> 20 -> 7)
This is a classic DFS problem where we explore each path to its deepest point and track the maximum depth encountered.
Approach:
root = [3,9,20,null,null,15,7]3root = [1,null,2]2root = []0The number of nodes in the tree is in the range [0, 10^4].-100 <= Node.val <= 100Click "Run" to execute your code against test cases
Socratic guidance - I'll ask questions, not give answers