上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 36 下一页
摘要: 1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 if (n < 3) return n; 5 int index = 1, rec = A[0], count =... 阅读全文
posted @ 2015-03-22 16:09 keepshuatishuati 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 if (n < 2) return n; 5 int rec = A[0], index = 1; 6 ... 阅读全文
posted @ 2015-03-22 16:06 keepshuatishuati 阅读(105) 评论(0) 推荐(0) 编辑
摘要: This question is different from Regular Expression Matching.Because this does not need totally match. We just have to much p is part of s. 1 class Sol... 阅读全文
posted @ 2015-03-22 16:01 keepshuatishuati 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Do not confused with check if (*p == '\0') return *s == '\0';p is the format that used to match. If p is already reaching end, s still has some chars ... 阅读全文
posted @ 2015-03-22 15:53 keepshuatishuati 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1. Use two vectors to store the nodes and values. Sort the values. 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 *... 阅读全文
posted @ 2015-03-22 15:43 keepshuatishuati 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Since it need to record the previous chars, we just have to maintain a queue. Actually, the number of left chars are no larger than 4. 1 // Forward de... 阅读全文
posted @ 2015-03-22 15:29 keepshuatishuati 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Read the buffer from file every time. After loop terminated, check whether the total lens is over 4.Then use n - len (a negative number) to set the en... 阅读全文
posted @ 2015-03-22 15:24 keepshuatishuati 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 double pow(double x, int n) { 4 bool sign = false; 5 if (n 0) {11 if (n%2 == 1) {12 ... 阅读全文
posted @ 2015-03-22 15:19 keepshuatishuati 阅读(135) 评论(0) 推荐(0) 编辑
摘要: I and two can use exactly same code. 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLinkNode { 4 * int val; 5 * TreeLink... 阅读全文
posted @ 2015-03-22 15:14 keepshuatishuati 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Assign a new vector as the size is length + 1. Because if the original is 9999...., the it will have one digit more. 1 class Solution { 2 public: 3 ... 阅读全文
posted @ 2015-03-22 15:02 keepshuatishuati 阅读(132) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 36 下一页