LeetCode – Verify Preorder Serialization of a Binary Tree (Java)
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If it is a null node, we record using a sentinel value such as #. 9 / \ 3 2 / \ / \ 4 1 # 6 / \ / \ … Read more