LCS问题即longest common subsequence problem,中文:最长公共子序列问题 给你两个字符串str1和str2,它们之间可能存在公有子序列,子序列和子串的区别是:子序列不要求连续,只需要按照顺序出现就好,子串则要求连续: 例如:SIMPLE和NAIVE有共同的子序列IE ...
分类:
其他好文 时间:
2016-11-26 23:20:09
阅读次数:
328
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length... ...
分类:
其他好文 时间:
2016-11-26 14:46:02
阅读次数:
160
找到提供的句子中最长的单词,并计算它的长度。 函数的返回值应该是一个数字. 这是一些对你有帮助的资源: String.split() String.length ...
分类:
其他好文 时间:
2016-11-24 18:10:53
阅读次数:
196
Bob’s Race Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description Bob wants to hold a race to encourage ...
分类:
其他好文 时间:
2016-11-24 06:22:07
阅读次数:
241
Naive Solution: use DP, Time O(N^2), Space O(N) dp[i] represents the length of longest increasing subsequence till i including element i in nums array ...
分类:
其他好文 时间:
2016-11-23 08:13:25
阅读次数:
117
题目如下: Suppose we abstract our file system by a string in the following manner: The string "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" represents: The di ...
分类:
其他好文 时间:
2016-11-22 23:24:39
阅读次数:
287
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: ...
分类:
编程语言 时间:
2016-11-22 22:52:05
阅读次数:
403
factor(x = character(), levels, labels = levels, exclude = NA, ordered = is.ordered(x), nmax = NA) levels因子水平,如果不指定,就是x中所有不重复的值 labels水平标识名称 exclude排除 ...
分类:
其他好文 时间:
2016-11-22 01:53:38
阅读次数:
183
【题目链接】 http://www.spoj.com/problems/LCS2/ 【题目大意】 求n个串的最长公共子串 【题解】 对一个串建立后缀自动机,剩余的串在上面跑,保存匹配每个状态的最小值, 取最小值中的最大值即可。由于跑的地方只记录了匹配结尾的状态, 所以还需要更新parent树上的状态 ...
分类:
其他好文 时间:
2016-11-16 01:53:26
阅读次数:
244
原题链接: http://oj.leetcode.com/problems/longest-substring-without-repeating-characters/ 这道题用的方法是在LeetCode中很常用的方法,对于字符串的题目非常有用。 首先brute force的时间复杂度是O(n^3 ...
分类:
其他好文 时间:
2016-11-14 17:43:16
阅读次数:
141