Dsa
Binary Search Tree
Hard
Binary Search Tree Level Order Traversal
Given a binary search tree, return the level order traversal of its nodes' values.
Input Format:
The first line contains an integer n, the number of nodes in the BST.
The second line contains n space-separated integers representing the values of the nodes.
Output Format:
Print the level order traversal as space-separated integers in a single line.
Example:
Input:
3
3 9 20 -1 -1 15 7
Output:
3 9 20 15 7
Key concepts
binary_treelevel_orderqueue
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