Same with I 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * ...
分类:
其他好文 时间:
2015-03-21 18:25:44
阅读次数:
148
Notes:1. If len dp(len+1, 0); 7 vector > rec(len, vector(len, false)); 8 for (int i = 0; i = 0; i--) {10 for (int j = i; ...
分类:
其他好文 时间:
2015-03-21 18:25:43
阅读次数:
136
1 class Solution { 2 public: 3 bool isP(string s) { 4 int start = 0, end = s.size()-1; 5 while (start > &result, vector current,...
分类:
其他好文 时间:
2015-03-21 17:02:38
阅读次数:
116
Scanning from start to end. If find a mismatch and one is larger size, keep search from the previous char of shorter one.Finally check whether found a...
分类:
其他好文 时间:
2015-03-21 16:56:01
阅读次数:
142
1. x/rec >= 10.2. find start and end of a number. 1 class Solution { 2 public: 3 bool isPalindrome(int x) { 4 if (x = 10) rec *= 10; 7 ...
分类:
其他好文 时间:
2015-03-21 16:54:58
阅读次数:
122
首先来看一段代码,看过上一节的朋友肯定对这段代码并不陌生。这一段代码诠释了Spring加载bean的完整过程,包括读取配置文件,扫描包,加载类,实例化bean,注入bean属性依赖。
public void refresh() throws BeansException, IllegalStateException {
synchronized (this.startupShut...
分类:
编程语言 时间:
2015-03-21 14:03:27
阅读次数:
155
1 class Solution { 2 public: 3 int hammingWeight(uint32_t n) { 4 int result = 0; 5 while (n > 0) { 6 if (n & 1) { 7 ...
分类:
其他好文 时间:
2015-03-21 11:10:00
阅读次数:
147
1 class Solution { 2 public: 3 void swap(int &a, int &b){int t = a; a = b; b = t;}; 4 void reverse(vector &num, int start, int end) { 5 ...
分类:
其他好文 时间:
2015-03-21 11:00:51
阅读次数:
98
Notes:1. Dont have to allocate l1*l2, just l1+l2 is fare enough.2. remember i--, j--.3. upgrade[i+j] is += not = rec[i+j+1]/10; 1 class Solution { 2 p...
分类:
其他好文 时间:
2015-03-21 09:45:21
阅读次数:
117
Brute Force: 1 class Solution { 2 public: 3 bool notExist(vector rec, int level, int current) { 4 for (int i = 0; i rec, vector &result) ...
分类:
其他好文 时间:
2015-03-21 09:44:49
阅读次数:
115