找出一个字符串数字里公共的开头字符串,没有的话返回""。自己做的时候想复杂了,其实直接比较久ok的。 提交到网上的版本是Vertical Comparasion的(比较不同字符串相同位置的字符)。在此记录一下Horizonal Comparision的方法。 还有更多更详细的解释在这里。 水平比较 ...
分类:
编程语言 时间:
2016-07-08 16:36:01
阅读次数:
158
Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Given a sequence of integer ...
分类:
其他好文 时间:
2016-07-08 01:34:36
阅读次数:
197
建立一个二维的表,每一个格子的值,都是以此位置为结尾的最长的增序序列。所以这个值需要上下左右四个值来确定,就是一个dfs。 需要注意的是,如果已经被算出结果的值不需要再算一遍。 所以整个dfs的结构是,算出上下左右的值,找到最大的那个,当前值是四周比它小的最长序列的长度+1,否则为1 ...
分类:
其他好文 时间:
2016-07-07 07:29:47
阅读次数:
164
Given two strings, find the longest common subsequence (LCS). Your code should return the length of LCS. Example Given two strings, find the longest c ...
分类:
其他好文 时间:
2016-07-06 13:14:34
阅读次数:
115
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Given an unsorted array of integers, find the lengt ...
分类:
其他好文 时间:
2016-07-05 06:23:14
阅读次数:
144
如果是素数直接输出1与素数,否则枚举长度和起始数即可。 ...
分类:
其他好文 时间:
2016-07-04 23:29:14
阅读次数:
154
Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc ...
分类:
编程语言 时间:
2016-07-03 14:25:52
阅读次数:
371