问题:寻找最长公共前缀思路:就是逐一检查每个string中的每一位,碰到不相等的时候,结束;每个string中这一位都相等,加入到common
prefix中~public String longestCommonPrefix(String[] strs) { int ...
分类:
其他好文 时间:
2014-05-19 21:12:05
阅读次数:
292
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-05-18 19:39:55
阅读次数:
355
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-05-18 01:52:45
阅读次数:
317
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 longes...
分类:
其他好文 时间:
2014-05-16 21:15:37
阅读次数:
454
Given a string, find the length of the longest
substring without repeating characters. For example, the longest substring
without repeating letters fo...
分类:
其他好文 时间:
2014-05-15 17:50:38
阅读次数:
298
问题描述
最长递增子序列也称 “最长上升子序列”,简称LIS ( longest increasing subsequence)。设L=是n个不同的实数的序列,L的递增子序列是这样一个子序列Lis=,其中k1
如:求一个一维数组arr[i]中的最长递增子序列的长度,如在序列{ 7, 1, 6, 5, 3, 4, 8 }中,最长递增子序列长度为4,其递增子序列为:1,3,4,8。...
分类:
其他好文 时间:
2014-05-15 15:06:59
阅读次数:
328
【题目】
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the len...
分类:
其他好文 时间:
2014-05-15 14:40:14
阅读次数:
320
Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings....
分类:
其他好文 时间:
2014-05-15 13:27:07
阅读次数:
233
【题目】
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.
【题意】
题意是找出字符串S中最长回文子串,S最长为1000,保证有唯一解
【思路】
原字符串用特殊字符#间隔,如下所示:
#a...
分类:
其他好文 时间:
2014-05-15 03:31:25
阅读次数:
299
题目
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", ...
分类:
其他好文 时间:
2014-05-14 01:10:30
阅读次数:
318