Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work.
30:00
Java
Serialize and Deserialize Binary Tree
hard
Topics
Companies
Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work.
Example 1:
Input: {"root":[1,2,3,null,null,4,5]}
Output: [1,2,3,null,null,4,5]
Constraints:
The number of nodes is in the range [0,104].
−1000≤Node.val≤1000
Input
arr ={"root":[1,2,3,null,null,4,5]}
Created root 1
1
Variables
No variables to display
DepthFunction Call
Stack empty
0/11
Asked in these interview guides
Company guides that list this problem among their sample questions.