Longest Ordered Subsequence
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 36159
Accepted: 15882
Description
A numeric sequence of ai is ordered if a1 a2 ...
分类:
其他好文 时间:
2015-03-21 09:49:34
阅读次数:
118
问题来源:https://leetcode.com/problems/longest-consecutive-sequence/import java.util.Arrays;/**
*
*
* ClassName LongestConsecutiveSequence
*
*
* Description Given an unsorted array of i...
分类:
其他好文 时间:
2015-03-20 16:26:45
阅读次数:
115
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(...
分类:
其他好文 时间:
2015-03-20 09:12:56
阅读次数:
119
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-03-20 09:12:38
阅读次数:
107
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
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
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
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
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
https://leetcode.com/problems/longest-consecutive-sequence/Given an unsorted array of integers, find the length of the longest consecutive elements se...
分类:
其他好文 时间:
2015-03-19 21:38:49
阅读次数:
164