Skip to content
C

Height of Binary Tree

Easyjavapythonccppjavascript

Find the height of a binary tree, measured as the number of nodes on its longest root-to-leaf path. An empty tree has height 0.

Input Format

The first line contains an integer M, the number of level-order tokens. The second line contains M space-separated tokens (integers or null). It is blank when M is 0.

Output Format

Print the height.

Input (stdin)

Output

Run your code to see output here...