Longest Ordered SubsequenceTime Limit:2000MSMemory Limit:65536KTotal Submissions:34440Accepted:15128DescriptionA numeric sequence ofaiis ordered ifa1#...
分类:
其他好文 时间:
2014-11-15 18:22:13
阅读次数:
162
Write a function to find the longest common prefix string amongst an array of strings.(每个字符串从0开始的公共部分即最长公共前缀)C++代码如下:#include#include#includeusing nam...
分类:
其他好文 时间:
2014-11-14 23:58:14
阅读次数:
463
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
题意:给一个长度为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
解题报告求最长路。用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
对于一个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
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
bullet 作为开源实时物理引擎,在速度和性能上有着优秀的表现。本文先后分析了bullet的内存对齐、动态数组,然后分析了std::ordered_map的内存布局,最后分析了btHashMap内存布局的独特之处,并解释了为什么这种设计有着优秀的性能表现。PS:对算法、数据结构、内存管理、高性能感兴趣的同学,此文值绝对得一看。...
分类:
其他好文 时间:
2014-11-09 15:20:57
阅读次数:
340
Description
You have a piece of iron wire with length of n unit. Now you decide to cut it into several ordered pieces and fold each piece into a triangle satisfying:
*All triangles are integral....
分类:
其他好文 时间:
2014-11-08 23:40:43
阅读次数:
396
前言以前HanLP使用“最短编辑距离”来做推荐器,效果有待提高,主要缺点是根据拼音序列的编辑距离推荐的时候,同音字交错很常见,而编辑距离却不那么大。这时我就在寻求一种补充的评分算法,去评判两个句子在拼音这一维度上的相似程度。区别最长公共子串(Longest Common Substring)指的是两...
分类:
编程语言 时间:
2014-11-07 16:17:17
阅读次数:
174