码迷,mamicode.com
首页 >  
搜索关键字:refresh    ( 1347个结果
LeetCode – Refresh – Majority Element
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 ...
分类:其他好文   时间:2015-03-20 09:11:55    阅读次数:143
LeetCode – Refresh – Longest Substring Without Repeating Characters
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) { ...
分类:其他好文   时间:2015-03-20 09:09:30    阅读次数:101
LeetCode – Refresh – Linked List Cycle
Just use two pointers. CC150 classical question 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNo...
分类:其他好文   时间:2015-03-20 08:06:22    阅读次数:125
LeetCode – Refresh – Longest Substring with At Most Two Distinct Characters
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...
分类:其他好文   时间:2015-03-20 08:06:07    阅读次数:164
LeetCode – Refresh – Longest Common Prefix
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()...
分类:其他好文   时间:2015-03-20 08:06:00    阅读次数:121
LeetCode – Refresh – Longest Palindromic Substring
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...
分类:其他好文   时间:2015-03-20 08:05:24    阅读次数:123
LeetCode – Refresh – Linked List Cycle II
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne...
分类:其他好文   时间:2015-03-20 08:03:53    阅读次数:125
LeetCode – Refresh – Length of Last Word
Tried it with spliting words method. But need to check empty situation. 1 class Solution { 2 public: 3 int lengthOfLastWord(const char *s) { 4 ...
分类:其他好文   时间:2015-03-20 08:03:07    阅读次数:129
LeetCode – Refresh – Longest Consecutive Sequence
It use the hashset to do the tricks. 1 class Solution { 2 public: 3 int longestConsecutive(vector &num) { 4 int len = num.size(), result =...
分类:其他好文   时间:2015-03-20 08:02:46    阅读次数:146
LeetCode – Refresh – Largest Rectangle in Histogram
Use two vector to record left and right indexes that can extend the blocks. 1 class Solution { 2 public: 3 int largestRectangleArea(vector &height...
分类:其他好文   时间:2015-03-20 08:02:31    阅读次数:126
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!