题目大意:给定一个初始字符串,提供两种操作:
1.在这个字符串的后面连接一个字符串
2.询问某个字符串在当前串中出现了多少次
SAM大叔的自动机~~
对于每个询问就是在后缀自动机上找到该子串所对应的节点 找不到返回0
然后这个节点的Right集合的大小就是这个子串的出现次数
每次Extend的时候将新建节点沿着parent指针到根的路径上所有点的Right集合大小+1即可
分裂节点的...
分类:
其他好文 时间:
2014-12-12 16:46:33
阅读次数:
236
获取子字符串slice() substr() substring() 不会修改字符串本身,他们只是返回一个基本类型的字符串值var str='abcdefghijklmn';1.传递一个参数 若为正值:三个返回结果相同(从参数下标值到字符串末尾) string.slice(3) =string.s....
分类:
其他好文 时间:
2014-12-12 16:19:22
阅读次数:
189
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 3. Fo...
分类:
其他好文 时间:
2014-12-12 11:49:07
阅读次数:
132
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:
其他好文 时间:
2014-12-12 06:44:13
阅读次数:
201
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The longes...
分类:
其他好文 时间:
2014-12-12 06:43:52
阅读次数:
120
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 3. Fo...
分类:
其他好文 时间:
2014-12-11 22:33:05
阅读次数:
403
JS截取字符串函数:一、函数:split();二、函数:John();三、函数:indexOf();四、其他几种方法:stringObject.substring(start,stop);stringObject.substr(start?[,?length?]) 一、函数:split() 功能:使用一...
分类:
Web程序 时间:
2014-12-11 12:37:00
阅读次数:
178
频道总排行调用方法<divclass="box">
<h5class="title-2">频道总排行</h5>
{pc:getsql="selecta.id,a.title,a.url,a.catid,b.hitsid,b.viewsfromv9_newsaleftjoinv9_hitsbona.id=substring(b.hitsid,5)wherea.catidin($arrchildid)orderbyb.viewsdesc"num="..
分类:
Web程序 时间:
2014-12-10 14:25:51
阅读次数:
195
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2014-12-10 01:41:06
阅读次数:
194
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once
and without ...
分类:
其他好文 时间:
2014-12-09 23:11:01
阅读次数:
275