- Don’t really need
- Be careful of the
termination condition: return
null. (1 because we need the number of nodes but not just depth)
- Three situations to consider
- Have both left and right child.
- Only left node.
- Only right node.
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
Note: A leaf is a node with no children.
Input: root = [3,9,20,null,null,15,7]