Saturday, October 21, 2017

[LeetCode]Serialize and Deserialize Binary Tree

可以参考Construct String From Binary Tree Construct Binary Tree From String的思路,代码如下:



另外我们也可以用题目给的思路来序列化,也就是层序遍历,代码如下:


No comments:

Post a Comment