上一页 1 ··· 32 33 34 35 36
摘要: 1 class Solution { 2 public: 3 int maxProfit(vector &prices) { 4 if (prices.size() < 2) return 0; 5 int len = prices.size(), resu... 阅读全文
posted @ 2015-03-18 07:09 keepshuatishuati 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Need a helper function to return the binary tree maximum height. If the return value is -1, it means there is a imbalanced subbranch . 1 /** 2 * Defi... 阅读全文
posted @ 2015-03-18 07:08 keepshuatishuati 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Use a hash table to record it. The tricky part is that when the hash value is > 0, it is the index + 1. Otherwise, that string already exists in resul... 阅读全文
posted @ 2015-03-18 07:06 keepshuatishuati 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Same with add binary. You can also skip delete the result pointer. But just return result->next. Depends on the interviewer. 1 /** 2 * Definition for... 阅读全文
posted @ 2015-03-18 07:04 keepshuatishuati 阅读(128) 评论(0) 推荐(0) 编辑
摘要: This question is pretty straight forward. 1 class Solution { 2 public: 3 string addBinary(string a, string b) { 4 int runnerA = a.size()-1... 阅读全文
posted @ 2015-03-18 07:03 keepshuatishuati 阅读(126) 评论(0) 推荐(0) 编辑
摘要: To be honest, I dont like this problem. This is just an extra layer loop for 3sum. But two mistakes I had made…..1. when skip j, use condition j > i+1... 阅读全文
posted @ 2015-03-18 07:00 keepshuatishuati 阅读(121) 评论(0) 推荐(0) 编辑
摘要: This problem is almost like 3sum. Actually it needs the same skip steps for j and k. But LeetCode did not put the test case there. So just put like th... 阅读全文
posted @ 2015-03-18 06:59 keepshuatishuati 阅读(130) 评论(0) 推荐(0) 编辑
摘要: For this problem, do not forget to skip the duplicates for i. Usually I will do duplication removal for j and k.Tag it. 1 class Solution { 2 public: 3... 阅读全文
posted @ 2015-03-18 06:57 keepshuatishuati 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36