...

/

Challenge: Find the Height of Binary Search Tree

Challenge: Find the Height of Binary Search Tree

Try to solve the Find the Height of a Binary Search Tree problem.

Statement

Given the root of a binary search tree, return the height of the tree. The height of the tree is the length of the longest path from the root node to any leaf node in the tree.

Note: The height of an empty tree is 0, whereas the height of a tree with a single node is 1.

Constraints:

  • 104-10^{4} \leqNode.data 104\leq 10^{4}

  • The tree contains nodes in the range [1,500][1, 500].

Examples

Access this course and 1400+ top-rated courses and projects.