class Solution {
public:
void dfs(vector<vector >&result, vectorcombination, vector&candidates, int kth, int k, int index2add){
// 当前正在确定组合中的第kth个数,将把候选集candidates中index2add索引位的值作为第kth个数加到组合中
combination.push_back(ca...
分类:
其他好文 时间:
2014-06-07 01:21:47
阅读次数:
220
近日在写一个简易的操作系统,经常受到bug的偷袭,由于开发OS的特殊性,一些常规的debug手段用不上,于是打算记录下自己的debug过程,用于交流。
Problem:
在做图层叠加时,引入结构体SHTCTL进行各个图层的管理,但遭遇了黑屏,原因可能来自于图层管理模块、内存管理模块或其他未知原因。
Solution:
恢复到上次不黑屏的版本(即去掉图层管理模块),果然可以进行显示。在此基础...
分类:
其他好文 时间:
2014-06-05 07:16:45
阅读次数:
199
比起POJ弱爆了一题,从后往前扫描一遍,O(n)时间,只要注意各种极端情况即可,不明白通过率为什么只有13%。
#include
#include
using namespace std;
class Solution {
public:
void reverseWords(string &s) {
char* cstr = new char[s.size()+1];
...
分类:
其他好文 时间:
2014-06-05 03:45:47
阅读次数:
221
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()...
分类:
其他好文 时间:
2014-06-05 02:15:14
阅读次数:
262
class Solution {private: static int
compare(const Interval& a, const Interval& b) { return a.start
merge(vector &intervals) { vector...
分类:
其他好文 时间:
2014-06-03 12:32:23
阅读次数:
228
问题
输入:一个表示数字的字符串,需要考虑不同的输入形式。
输出:对应的整数
特殊输入形式:
1.输入开始几个字符为空格
2.考虑正负号
3.数字字符不属于[0,9]时,输出当前结果
4.字符串代表的数字大于INT_MAX或者小于INT_MIN时输出INT_MAX或者INT_MIN。
class Solution {
// out of range...
分类:
其他好文 时间:
2014-06-03 06:30:14
阅读次数:
314
题目一:CombinationsGiven two integersnandk, return all
possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a
solution is:[ [2,4],....
分类:
其他好文 时间:
2014-05-31 20:01:02
阅读次数:
455
题目链接判断字符串是否为回文串。附上代码: 1 class Solution { 2 public:
3 bool isPalindrome(string s) { 4 if (s.empty()) return true; // consider empty
string ...
分类:
其他好文 时间:
2014-05-30 21:48:12
阅读次数:
347
这道题还是挺难的一道题,想法很重要 1 public class Solution { 2
public int minimumTotal(List> triangle) { 3 int size = triangle.size(); 4
int[] leve...
分类:
其他好文 时间:
2014-05-30 18:22:50
阅读次数:
249
Follow up for problem "Populating Next Right
Pointers in Each Node".What if the given tree could be any binary tree? Would
your previous solution stil...
分类:
其他好文 时间:
2014-05-30 16:17:49
阅读次数:
210