Dsa
Binary Search Tree
Easy
Max Depth of BST
Given a binary search tree (BST), write a function to find its maximum depth. The depth of a tree is defined as the length of the longest path from the root node down to the farthest leaf node. The input is provided in level-order format. Print the maximum depth.
Example Input:
3
1 2 4 null null 3 5
null null null null
Output:
3
Key concepts
binary_search_treedepth_calculation
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