码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果
LeetCode "Longest Valid Parentheses"
Your intuition would tell you that there's a O(n) solution. Actually it is another stack-based problem to solve.class Solution {public: struct Rec ...
分类:其他好文   时间:2014-08-06 14:37:41    阅读次数:186
LeetCode "Longest Palindromic Substring" - 1D DP
2D DP is an intuitive solution of course, but I got an MLE error, so I simplified it into a 1D DP:class Solution {public: void goDp(vector &dp, int...
分类:其他好文   时间:2014-08-06 06:14:40    阅读次数:196
HDU - 1403 - Longest Common Substring
先上题目:Longest Common SubstringTime Limit: 8000/4000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4010Accepted Submissi...
分类:其他好文   时间:2014-08-05 18:43:09    阅读次数:255
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 longest palindromic substring. 题意解析: 最长回文子串。就是...
分类:其他好文   时间:2014-08-05 15:56:59    阅读次数:290
leetcode Longest Common Prefix
找出单词的最长公共前缀class Solution {public: string longestCommonPrefix(vector &strs) { int len=strs.size(); if(len==0) return ""; ...
分类:其他好文   时间:2014-08-05 00:09:58    阅读次数:192
LCS (Longest Common Subsequence)
LCS是两个序列相似性的一种度量方法;若序列s1:2,5,7,9,3,1,2 s2:3,5,3,2,8则LCS为:5,3,2思路可参考:http://www.csie.ntnu.edu.tw/~u91029/LongestCommonSubsequence.html具体代码实现为: 1 #in...
分类:其他好文   时间:2014-08-04 13:47:37    阅读次数:290
Longest Palindromic Substring leetcode java
题目: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 lo....
分类:编程语言   时间:2014-08-04 04:10:26    阅读次数:374
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 for "abcabcbb" is "abc", which the length is 3....
分类:其他好文   时间:2014-08-03 23:29:46    阅读次数:283
uva10285 - Longest Run on a Snowboard(记忆化搜索)
题目:uva10285 - Longest Run on a Snowboard(记忆化搜索) 题目大意:给出N * N的矩阵,要求找到一条路径,路径上的值是递减的,求这样的路径的最长长度。 解题思路:记忆话搜索。因为要求最长的路径那么就需要将所有的这样的路径找出,但是直接dfs会超时的。对于同一个位置,从这个点出发的最长路径长度是固定的。所以在找的时候就要将这个位置的最长路径...
分类:其他好文   时间:2014-08-03 23:29:06    阅读次数:299
ZOJ3790_Consecutive Blocks
给出一个数组,最多可以删除k个数,问能够获得的最长的一个数字连续段为多少?把所有相同的数字都提取出来,保存取得每个数字需要删除的数字,然后二分枚举就可以了。召唤代码君:#include #include #include #include #define maxn 500200using names...
分类:其他好文   时间:2014-08-03 20:27:25    阅读次数:221
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!