码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果
POJ 2739 Sum of Consecutive Prime Numbers(素数)
POJ 2739 Sum of Consecutive Prime Numbers(素数)...
分类:其他好文   时间:2014-11-14 17:45:15    阅读次数:160
leetcode-longest palindromic substring-by 1337c0d3r
Given a string S, find the longest palindromic substring in S.Note:This is Part II of the article:Longest Palindromic Substring. Here, we describe an ...
分类:其他好文   时间:2014-11-12 21:05:22    阅读次数:345
486E - LIS of Sequence(LIS)
题意:给一个长度为n的序列,问每个数关于序列的LIS(longest increasing sequence)是什么角色。这里分了三种:           1、此数没有出现在任意一条LIS中           2、此数出现在至少一条但是不是全部的LIS中           3、此数出现在所有的LIS中 解法:nlgn的LIS算法可以求出以每个i位置结束的LIS长度up[i]。出现在L...
分类:其他好文   时间:2014-11-12 19:45:28    阅读次数:214
UVa10000_Longest Paths(最短路SPFA)
解题报告求最长路。用SPFA求最长路,初始化图为零,dis数组也为零#include #include #include #include #include #define inf 99999999#define N 110using namespace std;int mmap[N][N],dis...
分类:其他好文   时间:2014-11-11 12:39:12    阅读次数:117
找出矩阵中含有0最多的一行(find the longest row of zero)
对于一个n*n的矩阵,其中只包含有0,1两种元素且,所有的0都在1之前,请找出矩阵中0最多的一行。(Given an N-by-N matrix of 0s and 1s such that in each row no 0 comes before a 1, find the row with the most 0s in O(N) time.) 初看这题,想到的算法就是每一行都设置一个计...
分类:其他好文   时间:2014-11-10 23:30:00    阅读次数:446
POJ 2739 Sum of Consecutive Prime Numbers(素数打表水题)
【题意简述】:题意很简单,就是用连续的素数加和,计算有多少个这样的连续的素数数列可以使这个序列的和等于输入的数。 【分析】:很经典的素数模板,基本所有有关素数的题,我都会使用这个模板。 // 268K 16Ms #include using namespace std; #define N 10000 bool isprime[N]; long long prime[1300],np...
分类:其他好文   时间:2014-11-10 21:50:41    阅读次数:264
Longest Common Prefix
Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings. 1 public class Solution { 2 public Str...
分类:其他好文   时间:2014-11-10 19:53:49    阅读次数:228
最长公共子串、最长公共子序列的Java实现与NLP应用
前言以前HanLP使用“最短编辑距离”来做推荐器,效果有待提高,主要缺点是根据拼音序列的编辑距离推荐的时候,同音字交错很常见,而编辑距离却不那么大。这时我就在寻求一种补充的评分算法,去评判两个句子在拼音这一维度上的相似程度。区别最长公共子串(Longest Common Substring)指的是两...
分类:编程语言   时间:2014-11-07 16:17:17    阅读次数:174
Maximum Depth of Binary Tree
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ...
分类:其他好文   时间:2014-11-07 00:58:54    阅读次数:259
PAT 1040 Longest Symmetric String
#include #include using namespace std;char line[1001];char line2[2003];int syslen(char str[], int start) { int len = 1; int p = start - 1; in...
分类:其他好文   时间:2014-11-07 00:52:32    阅读次数:145
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!