今際の国の呵呵君
Saturday, October 21, 2017
[LeetCode]Construct Binary Tree from String
很直观的递归题,每次找到左子树对应的括号和右子树对应的括号然后递归地构建树即可,空间复杂度O(d),d为树的深度。时间复杂度O(n)。代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment