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 Tree Codec.
Ignoring the parent-child rule turns a focused search into a full maze traversal.
How you win
- 1Recognize when Serialize and deserialize binary tree matches the clues
- 2Keep this true after every move: each serialized subtree consumes exactly its root token followed by encodings of its left and right children
- 3Reach the result within O(n) encode and decode time
Rules and pressure
- Target cost: O(n) encode and decode time
- State rule: each serialized subtree consumes exactly its root token followed by encodings of its left and right children
Lesson 1 of 3
Preserve every missing child with #, then rebuild the exact shape from the same preorder stream.
Turn the tree into preorder tokens with explicit null slots.
Your call · Why do two # markers follow leaf 2?