Fetching algorithms...
Fetching algorithms...
root = [1,2,3,null,null,4,5][1,2,3,null,null,4,5]root = [][]root = [1][1]Serialize: use preorder traversal (root, left, right) with 'null' markers for empty nodes. Deserialize: reconstruct using the same preorder sequence by consuming values from queue/iterator.
Time Complexity
Space Complexity