总结帖http://blog.csdn.net/linhuanmars/article/details/39366817code 参考帖http://www.cnblogs.com/springfor/p/3869981.htmlhttp://blog.csdn.net/linhuanmars/ar...
分类:
其他好文 时间:
2015-04-19 12:54:10
阅读次数:
120
Write a function to find the longest common prefix string amongst an array of strings.思路:这道题其实很简单。只不过一开始我就想复杂了,一看求Longest,就联想到DP。然后又联想到Set来求交并。后来,突然想到...
分类:
其他好文 时间:
2015-04-19 12:54:06
阅读次数:
121
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-18 23:29:41
阅读次数:
123
题意:在一堆无序元素中找到最长的连续串的长度,要求时间复杂度O(N)
思路:首先将元素放到set集合中,然后再判断,每次判断是否包含某元素的复杂度为O(1)
代码:
public int longestConsecutive(int[] num) {
int currLen = 0, longestLen = Integer.MIN_VALUE;
Se...
分类:
其他好文 时间:
2015-04-18 10:09:13
阅读次数:
88
题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longe...
分类:
其他好文 时间:
2015-04-17 23:40:26
阅读次数:
127
题目的大意是:给出一序列,求出该序列的最长上升子序列的最大长度。
思路:
a: 1 7 3 5 9 4 8
dp: 1 2 2 3 4 3 4
#include
#include
using namespace std;
const int MAXN = 1005;
int main()
{
int n;
while( cin>>n )
{...
分类:
其他好文 时间:
2015-04-17 22:19:25
阅读次数:
169
(1)/** * This interface represents an ordered set of characters and defines the * methods to probe them.描述有序字符序列的接口。定义了探测这个序列的方法。 */public interface C...
分类:
其他好文 时间:
2015-04-17 20:20:00
阅读次数:
181
Substring
时间限制:1000 ms | 内存限制:65535 KB
难度:1
描述
You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of ...
分类:
其他好文 时间:
2015-04-17 18:24:31
阅读次数:
128
题目:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the long...
分类:
其他好文 时间:
2015-04-17 17:52:17
阅读次数:
118
Longest Palindromic Substring
Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique longest palindrom...
分类:
其他好文 时间:
2015-04-17 13:55:59
阅读次数:
162