- 博客(4)
- 收藏
- 关注
原创 leetcode#105 Construct Binary Tree from Preorder and Inorder Traversal
Desciption Given preorder and inorder traversal of a tree, construct the binary tree.这道题很简单,先序的第一个元素就是根元素,然后在中序中找到对应的位置,则左边的就是左子树,右边的即为右子树。值得注意的是,C++切片操作很难用,所以我就用Go写的解答。最后大部分debug时间都在解决语法问题T_TSoluti
2017-03-28 18:54:29 277
原创 leetcode#224 Basic Calculator
题目描述: Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or >minus sign -, non-negative integers
2017-03-23 15:35:31 370
原创 leetcode#94
Given a binary tree, return the inorder traversal of its nodes’ values. 给定一棵二叉树,返回它的中序遍历直接递归解决就可以了,没什么好说的。需要注意的是检查节点值是否为空。/** * Definition for a binary tree node. * struct TreeNode { * int v
2017-03-19 21:38:51 303
原创 leetcode#101 Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric But the following [1,2,2,null,3,null,3] i
2017-03-14 19:04:10 289
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人