4 Output: 2Explanation:Minimum depth is between nodes 1 and 2 since
minimum depth is defined as the number of
nodes along the shortest path from the root
node down to the nearest leaf node.
2 Output: 3Explanation:
Minimum depth is between nodes 10,20 and 40.
You don't need to read input or print anything. Complete the function minDepth() which takes the root node as an input parameter and returns the minimum depth.
Expected Time Complexity: O(N) Expected Auxiliary Space: O(height of the tree)