摘要:
Notes:1. Do not forget to check xi == xj. It will cause INF.2. DO not forget to initialize the iterator. 1 /** 2 * Definition for a point. 3 * struc...
阅读全文
posted @ 2015-03-20 09:00
keepshuatishuati
阅读(154)
推荐(0)
编辑
摘要:
1. Use memory :In the question, it already stated that there must be a majority element. So discard empty situation.Also it needs the number, not the ...
阅读全文
posted @ 2015-03-20 08:37
keepshuatishuati
阅读(153)
推荐(0)
编辑
摘要:
1 struct Node { 2 int key, value; 3 Node(int k, int v) : key(k), value(v) {} 4 }; 5 6 class LRUCache{ 7 private: 8 int size; 9 list ...
阅读全文
posted @ 2015-03-20 08:17
keepshuatishuati
阅读(110)
推荐(0)
编辑
摘要:
Notes:Do not forget to clean the total and rec. 1 class Solution { 2 public: 3 int longestValidParentheses(string s) { 4 int len = s.size(...
阅读全文
posted @ 2015-03-20 08:09
keepshuatishuati
阅读(106)
推荐(0)
编辑
摘要:
For this problem, we are OK to use hash set, since no numbers are needed. 1 class Solution { 2 public: 3 int lengthOfLongestSubstring(string s) { ...
阅读全文
posted @ 2015-03-20 07:58
keepshuatishuati
阅读(122)
推荐(0)
编辑
摘要:
At first beginning, I was trying to use hash set to record the characters. But I found that was wrong.Because if there are couple same chars, when you...
阅读全文
posted @ 2015-03-20 07:52
keepshuatishuati
阅读(128)
推荐(0)
编辑
摘要:
O(n2): 1 class Solution { 2 public: 3 string getP(string s, int start, int end) { 4 while (start >= 0 && end result.size()) result = s1;1...
阅读全文
posted @ 2015-03-20 07:33
keepshuatishuati
阅读(106)
推荐(0)
编辑