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 Inorder Path.
Ignoring the parent-child rule turns a focused search into a full maze traversal.
How you win
- 1Recognize when Iterative inorder traversal matches the clues
- 2Keep this true after every move: the stack holds the path to the next unvisited node and every emitted node precedes all remaining nodes in inorder
- 3Reach the result within O(n) time and O(height) space
Rules and pressure
- Target cost: O(n) time and O(height) space
- State rule: the stack holds the path to the next unvisited node and every emitted node precedes all remaining nodes in inorder
Lesson 1 of 3
Predict the visit order first. Null preserves a missing child slot; equal values still have distinct node identities. Lesson questions refer to the original tree.
Save the ancestors you must return to while descending left.
Your call · The stack holds 4, 2, 1 and current=null. Which value is emitted next?