Grokking Meta Coding Interview
0% completed
Minimum Depth of a Binary Tree (easy)
On This Page
Problem Statement
Examples
Try it yourself
Problem Statement
Given a root of the binary tree, find the minimum depth of a binary tree.
The minimum depth is the number of nodes along the shortest path from the root node to the nearest leaf node.
Examples
Example 1
Example 2
Constraints:
- The number of nodes in the tree is in the range [0, 10<sup>5</sup>].
-1000 <= Node.val <= 1000
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
Mark as Completed
B
Becca
· 4 years ago
Can you please explain a situation when need the 2nd minimumTreeDepth? My understanding is that you would always hit the first return statement first.
Show 1 reply
On This Page
Problem Statement
Examples
Try it yourself