码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
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
UVA 10935 约瑟夫环
Throwing cards away I Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description Given is an ordered deck of n cards numbered 1 to n with card 1 at the t...
分类:其他好文   时间:2014-08-04 17:38:47    阅读次数:272
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
POJ 1159 Palindrome 题解
本题的题意理解之后,就是求最长回文子序列 longest palindrome subsequence,这里注意子序列和子串的区别。 有两种求法,一种是直接求,相当于填矩阵右上对角阵,另一种是转化为longest common subsequence的求法。 最大难点就是要求内存不能使用二维的。 故此第一种方法是有点难度的,因为需要把二维矩阵的对角线转化为一维表记录,对好下标就好了。 第二中...
分类:其他好文   时间:2014-08-02 23:32:34    阅读次数:326
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!