Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Construct Tree From Preorder and Inorder

Medium Binary Trees

Given the preorder and inorder traversals of a binary tree with unique values, rebuild the tree and print it in level-order using null for gaps (omit trailing nulls).

Constraints

1 <= n <= 3000 All values are unique

Discussion

No discussions yet.

Rewards · v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.