@@ -0,0 +1,615 @@
+class Solution:%0A    def isValidSerialization(self, preorder):%0A        %22%22%22%0A        :type preorder: str%0A        :rtype: bool%0A        %22%22%22%0A        arr_pre_order = preorder.split(',')%0A        %0A        stack = %5B%5D%0A        for node in arr_pre_order:%0A            stack.append(node)%0A            while len(stack) %3E 1 and stack%5B-1%5D == '#' and stack%5B-2%5D == '#':%0A                stack.pop()%0A                stack.pop()%0A                if len(stack) %3C 1:%0A                    return False%0A                stack%5B-1%5D = '#'%0A                %0A        if len(stack) == 1 and stack%5B0%5D == '#':%0A            return True%0A        return False%0A

Verify Preorder Serialization of a Binary Tree