Simple C++ Solution, Comment your thoughts: Time and Space O(N)
\nclass Codec {\npublic:\n\n    // Encodes a tree to a single string.\n    string serialize(TreeNode* root) {\n        if(!root){\n            return "NULL";\n 
```\nclass Codec {\npublic:\n\n    // Encodes a tree to a single string.\n    string serialize(TreeNode* root) {\n        if(!root){\n            return "NULL";\n        }\n        \n        string left = serialize(root->left);\n        string right = serialize(root->right);\n        \n        return to_string(root->val) + " " + left + " " + right;\n    }\n    \n    TreeNode* helper_des(stringstream& ss, string s) {\n        ss >> s;\n        if(s == "NULL"){\n            return NULL;\n        }\n        \n        TreeNode* root = new TreeNode(stoi(s));\n        \n        root->left = helper_des(ss, s);\n        root->right = helper_des(ss, s);\n        \n        return root;\n    }\n\n    // Decodes your encoded data to tree.\n    TreeNode* deserialize(string data) {\n        stringstream ss(data);\n        return helper_des(ss, "");\n    }\n};\n```
['C']