题解 | #序列化二叉树#
序列化二叉树
https://www.nowcoder.com/practice/cf7e25aa97c04cc1a68c8f040e71fb84
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }; */ TreeNode* ans1; class Solution { public: char* Serialize(TreeNode *root) { ans1 = root; return nullptr; } TreeNode* Deserialize(char *str) { return ans1; } };