码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果)
leetcode - Longest Palindromic Substring
leetcode -Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000,...
分类:其他好文   时间:2015-08-17 00:58:54    阅读次数:112
Longest Common Subsequence (LCS)
最长公共子序列(LCS)是经典的DP问题,求序列a[1...n], b[1..m]的LCS。状态是DP[i][j],表示a[1..i],b[1..j]的LCS。DP转移方程是DP[i][j]= DP[i-1][j-1]+1, a[i] == b[j] max{ DP[i][j-1], DP[i...
分类:其他好文   时间:2015-08-17 00:39:46    阅读次数:159
【LeetCode】104 - Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:其他好文   时间:2015-08-15 22:42:42    阅读次数:138
EularProject 47:具有相同个数因子的连续数字
Distinct primes factors Problem 47 The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 7 15 = 3 × 5The first three consecutive numbers to have three distinct prime fact...
分类:其他好文   时间:2015-08-15 21:36:32    阅读次数:233
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-08-15 21:22:37    阅读次数:112
[LeetCode] 032. Longest Valid Parentheses (Hard) (C++)
指数:[LeetCode] Leetcode 指标解释 (C++/Java/Python/Sql)Github: https://github.com/illuz/leetcode032. Longest Valid Parentheses (Hard)链接:题目:https://oj.leetco...
分类:编程语言   时间:2015-08-15 19:41:24    阅读次数:116
spoj 1811 LCS - Longest Common Substring (后缀自动机)
spoj 1811 LCS - Longest Common Substring 题意: 给出两个串S, T, 求最长公共子串。 限制: |S|, |T| 思路: dp O(n^2) 铁定超时 后缀数组 O(nlog(n)) 在spoj上没试过,感觉也会被卡掉 后缀自动机 O(n) 我们考虑用SAM读入字符串B; 令当前状态为s,同时最大匹配长度为len;...
分类:其他好文   时间:2015-08-14 21:29:35    阅读次数:121
spoj 1812 LCS2 - Longest Common Substring II (后缀自动机)
spoj 1812 LCS2 - Longest Common Substring II 题意: 给出最多n个字符串A[1], ..., A[n], 求这n个字符串的最长公共子串。 限制: 1 |A[i]| 思路: 和spoj 1811 LCS差不多的做法 把其中一个A建后缀自动机 考虑一个状态s, 如果A之外的其他串对它的匹配长度分别是a[1], a[2],...
分类:其他好文   时间:2015-08-14 21:28:39    阅读次数:233
LeetCode104:Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Show Tags Show Similar Proble...
分类:其他好文   时间:2015-08-14 01:11:52    阅读次数:136
LIS最长上升子序列 (nlogn) poj1631
问题描述:LIS(Longest Increasing Subsequence)最长上升(不下降)子序列,有两种算法复杂度为O(n*logn)和O(n^2)。在上述算法中,若使用朴素的顺序查找在D1..Dlen查找,由于共有O(n)个元素需要计算,每次计算时的复杂度是O(n),则整个算法的时间复杂度...
分类:其他好文   时间:2015-08-13 21:57:56    阅读次数:185
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!