Python - DFS || Easy and Simple Solution
\nclass Codec:\n    def serialize(self, root: Optional[TreeNode]) -> str:\n        res = []\n        \n        def dfs(node):\n            if not node:\n       
```\nclass Codec:\n    def serialize(self, root: Optional[TreeNode]) -> str:\n        res = []\n        \n        def dfs(node):\n            if not node:\n                res.append("N")\n                return\n            res.append(str(node.val))\n            dfs(node.left)\n            dfs(node.right)\n            \n        dfs(root)\n        return ",".join(res)\n        \n    def deserialize(self, data: str) -> Optional[TreeNode]:\n        vals = data.split(",")\n        self.i = 0\n        \n        def dfs():\n            if vals[self.i] == "N":\n                self.i += 1\n                return None\n            node = TreeNode(int(vals[self.i]))\n            self.i += 1\n            node.left = dfs()\n            node.right = dfs()\n            return node\n        return dfs()\n```
['Depth-First Search', 'Python3']