Dsa
Binary Search Tree
Warm-up
Find BST Depth
Given the root of a binary search tree, determine its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Input format: The first line contains an integer n (number of nodes). The next n lines each contain an integer value indicating the node values in the BST. Output the maximum depth of the BST. Example: Input: 5
3
1
4
0
2
Output: 3
Key concepts
binary_search_treedepthtraversal
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