Problem context and objectives
Mission briefing
Archive pathfinder · Clues branch through a living archive
Explore only the branches that can still contain the answer: The Traversal Builder.
Ignoring the parent-child rule turns a focused search into a full maze traversal.
How you win
- 1Recognize when Construct tree from preorder and inorder matches the clues
- 2Keep this true after every move: build(preStart,left,right) constructs exactly the inorder interval using its corresponding preorder slice
- 3Reach the result within O(n) time with an inorder index map
Rules and pressure
- Target cost: O(n) time with an inorder index map
- State rule: build(preStart,left,right) constructs exactly the inorder interval using its corresponding preorder slice
Lesson 1 of 3
Take the next root from preorder and choose its exact divider position inside the active inorder interval.
Take the root from preorder and split the inorder rail around it.
Your call · Root 3 is at inorder index 1. How many nodes belong to its left subtree?