问题描述:
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 palindromic substring.
基本思想:
本题的navi...
分类:
其他好文 时间:
2014-12-08 23:04:00
阅读次数:
221
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-12-08 21:07:17
阅读次数:
128
最长公共子序列
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。
tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合...
分类:
其他好文 时间:
2014-12-08 17:56:00
阅读次数:
183
额、、失误、、LCS是Longest Common Subsequence的缩写,即最长公共子序列。一个序列,如果是两个或多个已知序列的子序列,且是所有子序列中最长的,则为最长公共子序列。DP、O(n^2)解法:#include #include #include using namespace s...
分类:
其他好文 时间:
2014-12-08 13:51:44
阅读次数:
161
给定一个数组,找出里面连续的子序列的最长长度。例如:Given[100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is[1, 2, 3, 4]. Return its length:4.思路一:排序,然后count一下就o...
分类:
其他好文 时间:
2014-12-06 20:15:40
阅读次数:
166
题目描述:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating lette...
分类:
其他好文 时间:
2014-12-05 21:10:24
阅读次数:
187
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 le...
分类:
其他好文 时间:
2014-12-05 21:07:13
阅读次数:
167
http://www.spoj.com/problems/LCS2/发现了我原来对sam的理解的一个坑233本题容易看出就是将所有匹配长度记录在状态上然后取min后再对所有状态取max。但是不要忘记了一点:更新parent树的祖先。为什么呢?首先如果子树被匹配过了,那么长度一定大于任意祖先匹配的长度...
分类:
其他好文 时间:
2014-12-05 07:04:26
阅读次数:
318
Longest Substring Without Repeating Characters...
分类:
其他好文 时间:
2014-12-04 21:39:24
阅读次数:
237
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2014-12-04 21:12:36
阅读次数:
269