You are given a binary trees \(T\) with \(N\) nodes.
Output the minimum depth of \(T\).
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 node is a node with no children.
First line contains single integer: \(N\).
Following lines of input describe the \(T\).
First line contains single integer : \(root\)
Next \(N\) lines contains two integers each, index of left child and right child of node with index \(i\). If any of integer is \(-1\) then corresponding child is absent.
Ouput minimum depth of given binary tree.
\(1\) \(\leq\) \(N\) \(\leq\) \(10^5\)
3 1 2 -1 -1 3 -1 -1
You can use this template to submit the solution.