问题背景:
现有文本串
t
t
t 与模式串
p
p
p,要求用尽可能小的时间复杂度找到并输出
p
p
p 在
t
t
t 出现的所有位置。
解决此问题的关键在于前缀函数。
参考资料:
KMP Algorithm