Dsa
Trees
Warm-up
Inorder Traversal of a Tree
Given a binary tree, you need to return the inorder traversal of its nodes' values as a list.
Input Format:
- The input consists of lines representing the binary tree in level-order where each line contains either an integer (node value) or 'null' (indicating the absence of a node). The input ends when there are no more lines.
Output Format:
- Output should be a list of integers representing the inorder traversal of the tree.
Example:
Input:
1
2
3
null
null
4
null
null
null
Output:
[2, 1, 4, 3]
Key concepts
treestraversalinorder
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