Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c ...
分类:
其他好文 时间:
2017-10-20 14:37:09
阅读次数:
143
原题链接在这里:https://leetcode.com/problems/count-binary-substrings/description/ 题目: Give a string s, count the number of non-empty (contiguous) substrings ...
分类:
其他好文 时间:
2017-10-18 10:14:49
阅读次数:
163
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th... ...
分类:
其他好文 时间:
2017-10-18 00:22:21
阅读次数:
153
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th ...
分类:
其他好文 时间:
2017-10-16 21:53:23
阅读次数:
121
题意:给一个字符串,求它不同的子串的个数 方法:后缀数组,答案是sum(n-sa[i]+height[i]) 代码: ...
分类:
其他好文 时间:
2017-10-09 23:57:37
阅读次数:
390
题意:给定上一个串,问你多少种UVU这一种形式的串,其中U不为空并且V的长度给定了。 析:枚举 U 的长度L,那么U一定是经过 0 L 2L 3L .... 其中的一个,所以求两个长度反lcp,一个向前延伸lcp1,一个向后延伸lcp2,然后加起来,要保证每个都不超过L,否则就会重复,然后个数就是 ...
分类:
编程语言 时间:
2017-10-05 12:23:52
阅读次数:
150
http://poj.org/problem?id=3415 题意:求长度不小于K的公共子串的个数。 思路:好题!!!拉丁字母让我Wa了好久!!单调栈又让我理解了好久!!太弱啊!! 最简单的就是暴力枚举,算出LCP,那么这个LCP对答案的贡献就是$x-k+1$。 我们可以将height进行分组,大于 ...
分类:
编程语言 时间:
2017-10-03 12:40:31
阅读次数:
141
Common Substrings Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11469 Accepted: 3796 Description A substring of a string T is defined as: ...
分类:
编程语言 时间:
2017-10-02 12:43:09
阅读次数:
227
原题链接在这里:https://leetcode.com/problems/unique-substrings-in-wraparound-string/description/ 题目: Consider the string s to be the infinite wraparound stri ...
分类:
其他好文 时间:
2017-09-23 10:21:22
阅读次数:
144
题意:求字符串中不同子串的个数。 解题关键:每个子串一定是某个后缀的前缀,那么原问题等价于求所有后缀之间的不相同的前缀的个数。 1、总数减去height数组的和即可。 注意这里height中为什么不需要进行组合计数,因为,每一个height的左端点已经确定,所以只需变动右端点,总共$height[i ...
分类:
编程语言 时间:
2017-09-22 22:39:51
阅读次数:
228