摘要: /* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class Solution { //空树不是任意... 阅读全文
posted @ 2017-08-06 11:50 双马尾是老公的方向盘 阅读(249) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int NumberOf1(int n) { int count = 0; unsigned int flag = 1; while (flag) { if (n & flag) count++; ... 阅读全文
posted @ 2017-08-06 11:10 双马尾是老公的方向盘 阅读(109) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: void quanpailie(vector &shuchu, string &temp, int start, int end) { if (start == end) { shuchu.push_back(temp); } for (i... 阅读全文
posted @ 2017-08-06 11:04 双马尾是老公的方向盘 阅读(131) 评论(0) 推荐(0) 编辑
摘要: /* struct RandomListNode { int label; struct RandomListNode *next, *random; RandomListNode(int x) : label(x), next(NULL), random(NULL) { } }; */ class Solution { public: ... 阅读全文
posted @ 2017-08-05 23:09 双马尾是老公的方向盘 阅读(131) 评论(0) 推荐(0) 编辑
摘要: //肯定是要用中序遍历。。。可是开始不怎么会弄 //为什么这么菜 /* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }... 阅读全文
posted @ 2017-08-05 22:05 双马尾是老公的方向盘 阅读(115) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int Add(int num1, int num2) { while (num2--) { num1++; } return num1; } }; 阅读全文
posted @ 2017-08-05 01:07 双马尾是老公的方向盘 阅读(220) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int Add(int num1, int num2) { while (num2--) { num1++; } return num1; } }; 阅读全文
posted @ 2017-08-05 01:05 双马尾是老公的方向盘 阅读(101) 评论(0) 推荐(0) 编辑
摘要: //递归做的 开始用动态规划做 类似通配符问题 总感觉有问题 答案里面用dp做的多多少少有点问题 //估计是我水平太低 //只是其中一个带符号! class Solution { public: bool match(char* str, char* pattern) { if(str==NULL||pattern==NULL) { ... 阅读全文
posted @ 2017-08-04 23:49 双马尾是老公的方向盘 阅读(149) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: bool isNumeric(char* string) { if(string == NULL) return false; if(*string == '+' || *string == '-') string++; ... 阅读全文
posted @ 2017-08-04 16:05 双马尾是老公的方向盘 阅读(174) 评论(0) 推荐(0) 编辑
摘要: class Solution { string str; int hash[256]; public: //Insert one char from stringstream void Insert(char ch) { str.push_back(ch); hash[ch]++; } //return the fi... 阅读全文
posted @ 2017-08-04 16:00 双马尾是老公的方向盘 阅读(121) 评论(0) 推荐(0) 编辑