题意:求一个字符串的不相同的子串个数 n<=1000 思路:这是一道论文题 ...
分类:
编程语言 时间:
2017-02-18 10:44:50
阅读次数:
215
Check out this brilliant solution:https://discuss.leetcode.com/topic/70658/concise-java-solution-using-dp My first solution was a O(n^2) typical DP bo ...
分类:
其他好文 时间:
2017-01-28 15:55:20
阅读次数:
202
http://www.spoj.com/problems/NSUBSTR/ (题目链接) 题意 给出一个字符串S,令${F(x)}$表示S的所有长度为x的子串出现次数的最大值。求${F(1)......F(length(S))}$ Solution 后缀自动机例题,下面写几点自己认为理解后缀自动机的 ...
分类:
其他好文 时间:
2017-01-15 18:22:29
阅读次数:
230
http://poj.org/problem?id=3415 (题目链接) 题意 给定两个字符串 A 和 B,求长度不小于 k 的公共子串的个数(可以相同)。 Solution 后缀数组论文题。。。 基本思路是计算 A 的所有后缀和 B 的所有后缀之间的最长公共前缀的长度,把最长公共前缀长度不小于 ...
分类:
其他好文 时间:
2017-01-13 10:10:31
阅读次数:
242
【题目分析】 判断有多少个长度不小于k的相同子串的数目。 N^2显然是可以做到的。 其实可以维护一个关于height的单调栈,统计一下贡献,就可以了。 其实还是挺难写的OTZ。 【代码】 ...
分类:
编程语言 时间:
2017-01-04 00:10:03
阅读次数:
261
https://leetcode.com/problems/unique-substrings-in-wraparound-string/ 好,我自己做出来的。多总结规律,多思考。 ...
分类:
其他好文 时间:
2016-12-11 02:23:31
阅读次数:
140
Consider the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyza ...
分类:
其他好文 时间:
2016-12-07 23:34:21
阅读次数:
187
Analysis: Given a string s, find out all chars that are invalid (i.e., count < k). The longest substring must reside in one of the substrings divided ...
分类:
其他好文 时间:
2016-12-01 14:23:42
阅读次数:
172
Description String analysis often arises in applications from biology and chemistry, such as the study of DNA and protein molecules. One interesting p ...
分类:
编程语言 时间:
2016-11-23 07:40:21
阅读次数:
167
Description Given a string, find a substring of it which the original string contains exactly n such substrings. Description Given a string, find a su ...
分类:
编程语言 时间:
2016-11-17 23:15:24
阅读次数:
211