Dsa
Binary Search Tree
Easy
Find Height of BST
You need to determine the height of a binary search tree (BST) provided as an array of integers. The height of a tree is defined as the longest path from the root node down to the farthest leaf node.
Input Format:
- The first line contains an integer N, the number of nodes in the BST.
- The following N lines each contain a single integer representing the value of the node.
Output Format:
- Print a single integer representing the height of the BST.
Example:
Input:
5
10
5
15
3
7
Output:
3
Key concepts
binary_search_treeheightrecursive
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now