码迷,mamicode.com
首页 >  
搜索关键字:longest    ( 2697个结果
[leetcode]_Longest Common Prefix
问题:寻找最长公共前缀思路:就是逐一检查每个string中的每一位,碰到不相等的时候,结束;每个string中这一位都相等,加入到common prefix中~public String longestCommonPrefix(String[] strs) { int ...
分类:其他好文   时间:2014-05-19 21:12:05    阅读次数:292
【leetcode】Longest Palindromic Substring
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
LeetCode 014 Longest Common Prefix
【题目】 Write a function to find the longest common prefix string amongst an array of strings. 【题意】 求一组字符串的最长公共前缀 【思路】 使用归并思想求解 要求字符串[1,2,..,k,k+1,...n]的最大公共前缀,先分别求[1,2,...k]和[k+1,...,n]的公共前缀...
分类:其他好文   时间:2014-05-18 05:17:53    阅读次数:232
【LeetCode】Longest Consecutive Sequence
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
Leetcode | Longest Palindromic Substring
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
Longest Substring Without Repeating Characters
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)求解
问题描述 最长递增子序列也称 “最长上升子序列”,简称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
LeetCode-003 Longest Substring Without Repeating Characters
【题目】 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
[LeetCode]Longest Common Prefix
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
LeetCode-005 Longest Palindromic Substrin
【题目】 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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!