Height of a Binary Tree
EasyThe height of a binary tree is the maximum number of edges between the root and its leaf nodes.
Given a binary tree root, calculate the height of the tree.
For example, let's say you're given the following binary tree:
The height is
2
since leaf nodes -4, 7, and 8 are 2 edges away from the root.Try it
Solution
9 Essential Trees & Graphs Coding Interview Problems
Master Trees & Graphs by trying the coding challenges below.
- 1.Inorder TraversalEasy
- 2.Tree SumEasy
- 3.Tree HeightEasy
- 4.LCAMedium
- 5.Max Path SumHard
- 6.Search mazeMedium
- 7.Number of islandsMedium
- 8.Kth SmallestMedium
- 9.Sort K ArraysHard