problem description: given a string s, you shou find the longest palindromic substring in there for example:input :"ssaass" ouput:"ssaass" one solutio ...
分类:
其他好文 时间:
2017-04-07 13:34:03
阅读次数:
183
对于一个字符串,请设计一个高效算法,找到字符串的最长无重复字符的子串长度。 给定一个字符串A及它的长度n,请返回它的最长无重复字符子串长度。保证A中字符全部为小写英文字符,且长度小于等于500。 测试样例: ...
分类:
其他好文 时间:
2017-04-06 01:24:13
阅读次数:
174
有关概念: 最长上升子序列(LIS,Longest Increasing Subsequence),在一个序列中最长的单调递增的子序列 例子: 输入: 2 1 5 3 6 4 8 9 7 输出: 5 (1)第一种解法: fi表示以第i个数结尾的LIS长度 对于序列中的一个数i,在i前面枚举数j,j满 ...
分类:
其他好文 时间:
2017-04-05 23:36:02
阅读次数:
159
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi ...
分类:
其他好文 时间:
2017-04-05 01:25:52
阅读次数:
144
查找最长回文子串 思路: 一个指针从头部,一个指针从尾部,对比每一个字母,若相等则可能是回文子串,则,检测子串是否回文,是则比较和已知的子串长度,更长就记录其起始和终止坐标,否则就放弃。 上面的思路是从两边向中间收束,另一个思路是从中间向两边发散。 具体如下: 先找当前下标为中心的回文子串,比较它和 ...
分类:
其他好文 时间:
2017-04-05 01:19:56
阅读次数:
175
Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc ...
分类:
其他好文 时间:
2017-04-04 20:53:02
阅读次数:
164
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 50827 Accepted: 22574 Description A numeric sequence of ai is o ...
分类:
其他好文 时间:
2017-04-04 16:42:40
阅读次数:
179
Longest Substring Without Repeating Characters 找无相同字符的最长子串,o(n)暴力判断即可 16. 3Sum Closest 对于给定整数,在给定数组中寻找三个数的和,使得这个和最接近这个整数 显然二分即可 14. Longest Common Pre ...
分类:
其他好文 时间:
2017-04-03 11:33:17
阅读次数:
170
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 l ...
分类:
其他好文 时间:
2017-04-02 19:31:02
阅读次数:
124
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 longes ...
分类:
其他好文 时间:
2017-04-02 12:34:53
阅读次数:
161