[Python] Simple solution
\nclass Solution:\n    def isValidSerialization(self, preorder: str) -> bool:\n        ## RC ##\n\t\t## APPROACH : GREEDY ##\n\t\t## LOGIC ##\n\t\t#\t1. we star
```\nclass Solution:\n    def isValidSerialization(self, preorder: str) -> bool:\n        ## RC ##\n\t\t## APPROACH : GREEDY ##\n\t\t## LOGIC ##\n\t\t#\t1. we start with root node, so slots = 1\n\t\t#\t2. Each node consumes 1 slot and adds 2 slots so. -1 + 2\n\t\t#\t3. Null node consumes 1 slot\n\t\t## TIME COMPLEXICITY : O(N) ##\n\t\t## SPACE COMPLEXICITY : O(1) ##\n        \n        nodes = 1\n        for node in preorder.split(\',\'):\n            nodes -= 1\n            if nodes < 0:\n                return False\n            if node != \'#\':\n                nodes += 2\n        return nodes == 0\n        \n```
['Python', 'Python3']