参考【1】:longest consecutive subsequence of a random permutation 第一个帖子: Theorem:The expected length of the longest increasing block in a random permu...
分类:
其他好文 时间:
2015-03-09 07:03:48
阅读次数:
206
题目大意:给出一个长字符串,问最长的前缀,使得这个前缀能用给出的一些元素组合而成思路:暴力dp,dp[i]表示长度为i的前缀能否被表示 1 /*{ 2 ID:a4298442 3 PROB:prefix 4 LANG:C++ 5 } 6 */ 7 #include 8 #include 9 #inc...
分类:
其他好文 时间:
2015-03-08 18:41:18
阅读次数:
158
Problem StatementGive two string $s_1$ and $s_2$, find the longest common substring (LCS). E.g: X = [111001], Y = [11011], the longest common substrin...
分类:
其他好文 时间:
2015-03-08 11:38:44
阅读次数:
143
1.题目描述Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.2.解决方案1class Solution {
public:...
分类:
其他好文 时间:
2015-03-06 11:22:23
阅读次数:
126
Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ...
分类:
其他好文 时间:
2015-03-05 16:15:49
阅读次数:
104
Write a function to find the longest common prefix string amongst an array of strings.
这个题目非常简单,只要弄清楚题意就可以非常快地解决,我的C++代码实现如下: string longestCommonPrefix(vector &strs) {
if (strs.empt...
分类:
其他好文 时间:
2015-03-04 19:13:18
阅读次数:
127
HDU 1403 Longest Common Substring(后缀数组啊 求最长公共子串 模板题)...
分类:
编程语言 时间:
2015-03-04 19:08:31
阅读次数:
161
代码: 1 #include 2 3 using namespace std; 4 5 int lengthOfLongestSubString(string s) 6 { 7 if (s.length() == 0) 8 return 0; 9 int max ...
分类:
其他好文 时间:
2015-03-04 18:52:52
阅读次数:
104
DP类题目找到子问题(状态),然后找到转移方程,就OK#dp#likes matrixchain#according to two point's distance to recurrenceclass Solution: # @return a string def longest...
分类:
其他好文 时间:
2015-03-04 18:51:45
阅读次数:
122
题目Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.代码/**
* Definition for binary tree
* p...
分类:
其他好文 时间:
2015-03-04 17:08:21
阅读次数:
118