Very simple and easy solution.
\n\n# Code\npython3 []\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, x):\n#         self.val = x\n#         self.left = Non
\n\n# Code\n```python3 []\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, x):\n#         self.val = x\n#         self.left = None\n#         self.right = None\n\nclass Codec:\n\n    def serialize(self, root: Optional[TreeNode]) -> str:\n        if not root:\n            return ""\n        \n        queue = deque([root])\n        output = []\n        \n        while queue:\n            current = queue.popleft()\n            if current:\n                output.append(str(current.val))\n                queue.append(current.left)\n                queue.append(current.right)\n            else:\n                output.append("null")\n        \n        # Join the list into a comma-separated string\n        return ",".join(output)\n\n    def deserialize(self, data: str) -> Optional[TreeNode]:\n        if not data:\n            return None\n        \n        nodes = data.split(",")\n        root = TreeNode(int(nodes[0]))\n        queue = deque([root])\n        i = 1\n        \n        while queue:\n            current = queue.popleft()\n            \n            # Handle left child\n            if nodes[i] != "null":\n                current.left = TreeNode(int(nodes[i]))\n                queue.append(current.left)\n            i += 1\n            \n            # Handle right child\n            if nodes[i] != "null":\n                current.right = TreeNode(int(nodes[i]))\n                queue.append(current.right)\n            i += 1\n        \n        return root\n\n# Example usage:\n# ser = Codec()\n# deser = Codec()\n# tree = ser.serialize(root)\n# ans = deser.deserialize(tree)\n# return ans\n\n```
['Python3']