Trace deserialize
Standard · Trace the algorithm · about 6 min
Rebuild the tree from "5,3,#,4,#,#,8,7,#,#,#". Before each step plays, click the node the next value hangs under.
Example 1
Input:
{"data":"5,3,#,4,#,#,8,7,#,#,#"}
Output:
[5,3,8,null,4,7]
Constraints
- The trace uses the input shown.
Learn the idea first: Serialization and construction, a visual lesson.
More Serialization and construction problems
- Serialize a tree to a string Warm-up
- Count distinct encodings Standard
- Serialize and deserialize Standard
- Build a balanced BST from a sorted array Standard