Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-09-09 11:49:38
阅读次数:
167
Longest Consecutive Sequence
Total Accepted: 19169 Total
Submissions: 68303My Submissions
Given an unsorted array of integers, find the length of the longest consecutive elements sequence...
分类:
其他好文 时间:
2014-09-07 21:12:55
阅读次数:
294
最长公共子序列
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述 咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。
tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此条件序列中最...
分类:
其他好文 时间:
2014-09-07 17:20:25
阅读次数:
221
Write a function to find the longest common prefix string amongst an array of strings.思路:依次比较即可。 1 class Solution { 2 public: 3 string longestComm...
分类:
其他好文 时间:
2014-09-07 14:46:45
阅读次数:
150
最长公共子序列(longest common subsequence)二维dp 状态dp[i][j]表示字符串x的前缀xi和字符串y的前缀yj能够构成的最长公共子序列的长度。 初始化:第0行和第0列的dp[i][0] 和 dp[0][j]都设为0. 递推:dp[i][j]=dp[i-1][j-...
分类:
其他好文 时间:
2014-09-06 10:57:13
阅读次数:
222
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 longest ...
分类:
其他好文 时间:
2014-09-04 16:41:59
阅读次数:
173
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the lon...
分类:
其他好文 时间:
2014-09-03 22:30:07
阅读次数:
211
本文讨论了最长公共子串的的相关算法的时间复杂度,然后在后缀数组的基础上提出了一个时间复杂度为o(n^2*logn),空间复杂度为o(n)的算法。该算法虽然不及动态规划和后缀树算法的复杂度低,但其重要的优势在于可以编码简单,代码易于理解,适合快速实现。
分类:
其他好文 时间:
2014-09-03 16:26:16
阅读次数:
309
given a string ,return the longest substring that contains at most twocharacters.extern "C" char *SubStringWithAtMost2Chars(char * pStr, int len){ ...
分类:
其他好文 时间:
2014-09-03 14:29:36
阅读次数:
211