摘要: 1.前序中序确定class Solution {public: TreeNode *buildTree(vector &preorder, vector &inorder) { if(preorder.size()==0||inorder.size()==0||preorder.size()!=inorder.size())return NULL; TreeNode *root=NULL; build(root,preorder,inorder,0,preorder.size()-1,0,inorder.size()-1); ... 阅读全文
posted @ 2013-05-15 23:34 代码改变未来 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Combination Sum回溯法应用数组不含重复元素,结果可含重复元素。回溯法。自己写的代码:class Solution {public:vector<vector<int>>v;vector<int>v1;int sum; vector<vector<int> > combinationSum(vector<int> &candidates, int target) { sort(candidates.begin(),candidates.end()); v.clear(); sum=0; backtrac 阅读全文
posted @ 2013-05-15 00:47 代码改变未来 阅读(277) 评论(0) 推荐(0) 编辑