[LeetCode] Verify Preorder Serialization of a Binary Tree

1 · · Feb. 11, 2022, 5:48 a.m.
331. Verify Preorder Serialization of a Binary Tree One way to serialize a binary tree is to use preorder 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 ‘#’. For example, the above binary tree can be serialized to the string “9,3,4,#,#,1,#,#,2,#,6,#,#”, where ‘#’ represents a null node. Given a string of comma-separated values preorder, return true if it is a correct preorder traversal serialization of a b...