45: Minimum depth of a binary tree
Given a binary tree
. Find a minimum depth
of the binary tree
Note: The
minimum depth
is the number of nodes from the root node to the nearest leaf node
Example 1
Input: 1
/ \
2 3
/ \
6 7
Output: 2
Explanation:
1 -> 2
Example 2
Input: 1
\
3
Output: 2