码迷,mamicode.com
首页 >  
搜索关键字:longest    ( 2697个结果
后缀数组学习笔记
后缀数组的用处:快速求出两个后缀Suffix(i), Suffix(j)的最长公共前缀(LCP, Longest Common Perfix)以下一张图片可谓简洁明了。下面贴上模板1.求最长重复子串,可以重叠void solve_duplicate_substr(int n){//duplicate...
分类:编程语言   时间:2015-01-25 15:04:43    阅读次数:311
[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...
分类:其他好文   时间:2015-01-25 11:03:14    阅读次数:129
Longest Substring with At Most Two Distinct
Given a string, find the length of the longest substring T that contains at most 2 distinct characters.For example, Given s =“eceba”,T is "ece" which ...
分类:其他好文   时间:2015-01-25 06:31:56    阅读次数:141
Leetcode#5 Longest Palindromic Substring
原题地址以前可以用DP枚举所有回文串,但是Leetcode后来增加了几组大数据,用DP会超时。什么!用DP都超时了??那怎么办?答:二分法尝试可能的回文串长度,直到找到最大值需要注意的是,假设现在已经验证了长度为length的回文串不存在,传统的二分法就会去尝试长度为length/2的回文串是否存在...
分类:其他好文   时间:2015-01-24 19:57:26    阅读次数:127
LeetCode Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 题意:求字符串数组的最长公共前缀 思路:首先找到最短的那个作为标尺,然后每次比较。 class Solution { public: string longestCommonPrefix(vector &st...
分类:其他好文   时间:2015-01-23 21:38:51    阅读次数:147
LeetCode3-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 ...
分类:其他好文   时间:2015-01-23 21:19:32    阅读次数:187
[LeetCode] 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...
分类:其他好文   时间:2015-01-23 18:12:03    阅读次数:171
LeetCode 003 Longest Substring Without Repeating Characters
题目描述:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example,...
分类:其他好文   时间:2015-01-23 16:15:18    阅读次数:131
uva 10285 The Tower of Babylon(记忆化搜索)
Problem C Longest Run on a Snowboard Input: standard input Output: standard output Time Limit: 5 seconds Memory Limit: 32 MB   Michael likes snowboarding. That's not very surprising, since snow...
分类:其他好文   时间:2015-01-23 14:43:53    阅读次数:111
Leetcode#32 Longest Valid Parentheses
原题地址方法I:动态规划len[i]表示从i开始到结束的最长合法括号串长度,则:如果s[i] == "(" 且 s[i+len[i+1]+1]==")",len[i] = len[i+1] + 2否则len[i] = 0方法II:辅助栈跟那个直方图求最大面积有点类似,用一个栈保存合法括号串的长度,显...
分类:其他好文   时间:2015-01-23 06:10:15    阅读次数:138
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!