Please enter your email address or userHandle.
Given a binary tree, find its minimum depth.
Minimum depth is between nodes 1 and 3.
Minimum depth is between nodes 10,20 and 40.
You dont need to read input or print anything. Complete the function minDepth() which takes root node as input parameter and returns the minimum depth.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(height of tree)
1 ≤ N ≤ 10^5
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.