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-12-10 01:41:06
阅读次数:
194
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-12-09 13:44:16
阅读次数:
210
Write a function to find the longest common prefix string amongst an array of strings.分析:这道题没什么好方法,暴力搜索比较即可,在用C++实现时有一个小trick就是"Ifposis equal to thest...
分类:
其他好文 时间:
2014-12-09 13:42:01
阅读次数:
143
问题描述:
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