Binary Tree Inorder Traversal

Easy

📝 Description

Given the root of a binary tree, return the inorder traversal of its nodes' values. Inorder traversal visits nodes in this order: left subtree, root, right subtree.

Input Format

Line 1: n (number of nodes) Line 2: n space-separated integers representing the binary tree in level order (null represented as -1)

Output Format

Space-separated integers representing inorder traversal

Constraints

0 ≤ n ≤ 100 -100 ≤ Node.val ≤ 100

🔍 Sample Input

3
1 -1 2 3
            

✅ Sample Output

1 3 2
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run