Python Solution
Hope it helps\n\n\nclass Solution:\n    def isValidSerialization(self, preorder: str) -> bool:\n        preorder = preorder.split(",")\n        n = len(preorder
Hope it helps\n\n```\nclass Solution:\n    def isValidSerialization(self, preorder: str) -> bool:\n        preorder = preorder.split(",")\n        n = len(preorder)\n        if preorder[0] == \'#\':\n            return n == 1\n        stack = [preorder[0]]\n        \n        for idx in range(1, n):\n            if preorder[idx] != \'#\':\n                stack.append(preorder[idx])\n            else:\n                if not stack:\n                    return idx == n - 1\n                stack.pop()    \n        return False\n\n```
['Stack', 'Binary Tree', 'Python', 'Python3']