Same algorithm with combination. Input as the (1..n), constraint is that the length of each combine should be k. 1 class Solution { 2 public: 3 vo...
分类:
其他好文 时间:
2015-03-19 06:20:58
阅读次数:
152
Similar to the sorted array. But we have to remember, the position of node not depends on the index. So we need do two more things:1. Ensure the point...
分类:
其他好文 时间:
2015-03-19 06:20:30
阅读次数:
132
Only different with preorder and postorder is that the root start from the beginning for preorder. 1 /** 2 * Definition for binary tree 3 * struct T.....
分类:
其他好文 时间:
2015-03-19 06:20:26
阅读次数:
122
For this problem just need to know the structure of two traversal.1. It is hard to find the root node in the inorder traversal but it is easy in posto...
分类:
其他好文 时间:
2015-03-19 06:19:44
阅读次数:
119
The different between I and II is that:1. For II, each number only can be chosen ONCE.2. The a number, in the array, encountered more than twice will ...
分类:
其他好文 时间:
2015-03-19 06:18:55
阅读次数:
135
Two notes:1. I dont know whether C++ has a good split function for STL as the JAVA. Need to figure it out.2. At the beginning, I tried to set tmp1 = t...
分类:
其他好文 时间:
2015-03-19 06:17:36
阅读次数:
130
This is a classical combination question. 1 class Solution { 2 public: 3 void getComb(vector > &result, const vector &num, vector current, int sum...
分类:
其他好文 时间:
2015-03-19 06:17:15
阅读次数:
97
对于新手来说,有时操作失误就会导致eclipse目录中的某些子目录或者文件无法删除。
这样的原因是,在工程目录中(不是eclipse上显示的,是真实的物理磁盘上的)这个目录或者文件已经不存在了,所以在删除的时候报错,无法删除,但是又想把eclipse上显示的遗留的不想要的目录或文件删除,怎么做呢,其实很简单,右键点击工程,然后选择Refresh选项,刷新一下工程即可。或者鼠标单击工程名字,然后按...
分类:
系统相关 时间:
2015-03-18 18:08:47
阅读次数:
121
Made a stupid bug....... When reverse the vector, stop it at mid. Otherwise, it will swap back......Mark!!!!!!!! 1 /** 2 * Definition for binary tree....
分类:
其他好文 时间:
2015-03-18 10:23:29
阅读次数:
120
This is pretty simple.Just use three element to pretain the result; 1 class Solution { 2 public: 3 int climbStairs(int n) { 4 vector dp(3,...
分类:
其他好文 时间:
2015-03-18 10:15:49
阅读次数:
137