Height Of Tree

Given a binary tree, find and return the height of given tree.

Input format :
Nodes in the level order form (separated by space). If any node does not have left or right child, take -1 in its place
Output format :
Height
Constraints :

1 <= N <= 10^5

Sample Input :
10
 9 
4 
-1 
-1 
 5 
 8 
-1 
6 
-1 
-1 
3 
-1 
-1
-1
Sample Output :
5

Comments

Post a Comment

Please give us your valuable feedback

Popular posts from this blog

Access and modify all the resources of our Wiki.js using WikiJS API

How to pass parameters in webhook?

Fahrenheit to Celsius