Height of a Binary Tree
Easy

Problem Statement

Given a binary tree, find its height. The height of a tree is the number of nodes along the longest path from the root node down to the farthest leaf node.

Examples

1Example 1
Input:
{ "tree": [ 1, 2, 3, 4, null, null, 5 ] }
Output:
3
2Example 2
Input:
{ "tree": [ 10, 20, 30, null, 40 ] }
Output:
3
3Example 3
Input:
{ "tree": [ 1 ] }
Output:
1
Loading...

Sign in to Run Code and Submit