Question bank › Binary Search Tree
Dsa Binary Search Tree Hard

BST Level Order Traversal with Max Depth

Implement a function that reads a Binary Search Tree (BST) from input and returns its level order traversal along with the maximum depth. The input consists of a pre-order traversal of the BST where each node is represented by an integer followed by a space, and '-1' indicates the absence of a node. The output should first print the level order traversal, followed by the maximum depth of the tree, separated by a new line. Example Input: 10 5 2 -1 -1 7 -1 -1 15 -1 -1 Example Output: 10 5 15 2

Key concepts

binary_search_treetraversaldepth

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
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.