上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 36 下一页
摘要: It use the hashset to do the tricks. 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { 4 int len = num.size(), result =... 阅读全文
posted @ 2015-03-20 07:25 keepshuatishuati 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Seach one by one. 1 class Solution { 2 public: 3 string getNext(const string& s1, const string& s2) { 4 int len = min(s1.size(), s2.size()... 阅读全文
posted @ 2015-03-20 07:22 keepshuatishuati 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文
posted @ 2015-03-20 07:18 keepshuatishuati 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Just use two pointers. CC150 classical question 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNo... 阅读全文
posted @ 2015-03-20 07:16 keepshuatishuati 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2015-03-20 07:13 keepshuatishuati 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Tried it with spliting words method. But need to check empty situation. 1 class Solution { 2 public: 3 int lengthOfLastWord(const char *s) { 4 ... 阅读全文
posted @ 2015-03-20 07:03 keepshuatishuati 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Use two vector to record left and right indexes that can extend the blocks. 1 class Solution { 2 public: 3 int largestRectangleArea(vector &height... 阅读全文
posted @ 2015-03-20 06:54 keepshuatishuati 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 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: ... 阅读全文
posted @ 2015-03-20 06:09 keepshuatishuati 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 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[], ... 阅读全文
posted @ 2015-03-20 05:54 keepshuatishuati 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2015-03-20 05:51 keepshuatishuati 阅读(120) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 36 下一页