Dsa
Binary Search Tree
Easy
Is BST Balanced
Check if a binary search tree is balanced. A balanced tree is defined such that the height of the two subtrees of any node never differ by more than one.
Input Format:
The first line contains an integer n, the number of nodes in the BST.
The next n lines contain integers representing the nodes to be inserted into the BST.
Output Format:
Print 'True' if the tree is balanced, otherwise print 'False'.
Example:
Input:
5
10
5
15
3
7
Output:
True
Key concepts
binary_search_treebalanced_treecheck_balance
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