题目大意:给出一个字符串,支持在线在字符串后面加一个字符串,查询一个字符串在串中出现过几次。
思路:如果不想写正解的话,这个题就是后缀自动机的简单应用。正解其实是LCT+SAM,但是时间比暴力慢一倍。。。
暴力就很简单了,正序建立后缀自动机,每次查询的时候找到位置直接输出size的值。注意两点,一个是分裂节点的时候,size也要复制过去。查询的时候发现找不到要return 0;
...
分类:
其他好文 时间:
2015-01-19 21:08:55
阅读次数:
225
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-common-prefix/14: Longest Common PrefixWrite a fu...
分类:
编程语言 时间:
2015-01-19 20:39:03
阅读次数:
205
Sqlserver中经常要操作一些时间类型的字段转换,我又不太记得住,所以搜集了以下的一些SqlserverConvertDateTime相关的资料发表在自己的小站里,方便自己以后要用的时候寻找,望对大家也有帮助.将sqlserver中table表的[datetime]字段值‘2007-11-071...
分类:
数据库 时间:
2015-01-19 09:12:05
阅读次数:
634
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repea...
分类:
其他好文 时间:
2015-01-18 23:57:54
阅读次数:
264
问题描述:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[...
分类:
其他好文 时间:
2015-01-18 18:36:06
阅读次数:
158
题目:
Given a string, find the length of the longest substring without repeating characters. For example,
the longest substring without repeating letters for "abcabcbb" is "abc", which the length is ...
分类:
编程语言 时间:
2015-01-17 18:10:44
阅读次数:
251
Substring with Concatenation of All WordsYou are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices o...
分类:
其他好文 时间:
2015-01-16 23:39:36
阅读次数:
225
最长公共子序列时间限制:3000 ms | 内存限制:65535 KB 难度:3描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个...
分类:
其他好文 时间:
2015-01-16 16:00:46
阅读次数:
145
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:
其他好文 时间:
2015-01-16 13:02:05
阅读次数:
154
题目:Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique longest palindromic substring.
思路:题目要求的s的一个最长回...
分类:
编程语言 时间:
2015-01-15 23:54:08
阅读次数:
207