Given a sequence of integers, find the longest increasing subsequence (LIS).You code should return the length of the LIS.ExampleFor [5, 4, 1, 2, 3], t...
分类:
其他好文 时间:
2014-12-29 06:31:53
阅读次数:
131
Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there...
分类:
其他好文 时间:
2014-12-28 23:38:24
阅读次数:
271
Longest Substring with At Most Two Distinct CharactersGiven a string, find the length of the longest substring T that contains at most 2 distinct char...
分类:
其他好文 时间:
2014-12-28 16:53:21
阅读次数:
198
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2014-12-27 20:14:16
阅读次数:
214
Longest Palindromic Substring-- HARD 级别Question SolutionGiven a string S, find the longest palindromic substring in S. You may assume that the maximum...
分类:
其他好文 时间:
2014-12-27 20:12:16
阅读次数:
136
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2014-12-26 20:14:20
阅读次数:
156
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 substrin...
分类:
其他好文 时间:
2014-12-26 14:40:43
阅读次数:
236
/*
* copyleft@hustyangju
* 问题:longest common subsequece problem
* 思路:从底往上,利用动态规划,划分子问题,利用LCS子问题的长度变化,求得LCS
* 时间复杂度O(m*n)
* 空间复杂度O(m*n)
*/
#include
#include
using namespace std;
class lcs
{
p...
分类:
编程语言 时间:
2014-12-26 13:01:52
阅读次数:
468
找到最多含有两个不同字符的子串的最长长度。例如:eoeabc,最长的是eoe为3,其他都为2.思路:用p1,p2表示两种字符串的最后一个出现的下标位置。初始p1为0. p2为-1.start初始化为0,表示两种字符串的开头。只要遍历一次string就可以得到结果了。首先我们要确定p2的值,那么i要一...
分类:
其他好文 时间:
2014-12-25 21:47:44
阅读次数:
150
题目:(String)Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique...
分类:
其他好文 时间:
2014-12-25 06:34:06
阅读次数:
198