This is just a combination. Use hashtable to hold the number ==> charsnotes:1. check corner case : input is empty, do not return vector contains empty...
分类:
其他好文 时间:
2015-03-20 08:03:21
阅读次数:
127
Corner case: when all the elements are 0. It should return "0", not "00000000".It use string to compare all the numbers. 1 class Solution { 2 public: ...
分类:
其他好文 时间:
2015-03-20 06:58:14
阅读次数:
109
Find the common length part, then check with two pointers. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 *...
分类:
其他好文 时间:
2015-03-20 06:57:04
阅读次数:
135
Do not forget to break the inner loop, when you find the insert position. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * ...
分类:
其他好文 时间:
2015-03-20 06:56:19
阅读次数:
120
Same with Jump Game I. Just need a step parameter and assume there is no "0" value in the array. 1 class Solution { 2 public: 3 int jump(int A[], ...
分类:
其他好文 时间:
2015-03-20 06:55:43
阅读次数:
124
Notes:1. Even s3 is empty string, if s1 and s2 are emtpy, then it should be true.2. Do not mess up the size of label. 1 class Solution { 2 public: 3 ....
分类:
其他好文 时间:
2015-03-20 06:54:54
阅读次数:
115
Pretty straight forward. 1 class Solution { 2 public: 3 string getRoman(int n, char ten, char five, char one) { 4 string result; 5 ...
分类:
其他好文 时间:
2015-03-20 06:53:42
阅读次数:
124
Need a corner case check for only one element [0]. 1 class Solution { 2 public: 3 bool canJump(int A[], int n) { 4 if (n = n-1) return tru...
分类:
其他好文 时间:
2015-03-20 06:51:03
阅读次数:
127
Similar to merge intervals. But this is easier than merge interval, because every side is kind of "sorted". 1 /** 2 * Definition for an interval. 3 .....
分类:
其他好文 时间:
2015-03-20 06:50:10
阅读次数:
123
Nothing fancy, just use recursive. 1 class Solution { 2 public: 3 void getP(vector &result, string current, int left, int right) { 4 if (l...
分类:
其他好文 时间:
2015-03-20 01:16:21
阅读次数:
113