Update 0459.重复的子字符串.md

This commit is contained in:
Rinko Taketsuki
2022-06-14 09:24:58 +08:00
committed by GitHub
parent 0a3a2d4ae2
commit 8f52696f22

View File

@ -63,7 +63,7 @@
next[len - 1] = 7next[len - 1] + 1 = 88就是此时字符串asdfasdfasdf的最长相同前后缀的长度。 next[len - 1] = 7next[len - 1] + 1 = 88就是此时字符串asdfasdfasdf的最长相同前后缀的长度。
(len - (next[len - 1] + 1)) 也就是: 12(字符串的长度) - 8(最长公共前后缀的长度) = 4 4正好可以被 12(字符串的长度) 整除所以说明有重复的子字符串asdf (len - (next[len - 1] + 1)) 也就是: 12(字符串的长度) - 8(最长公共前后缀的长度) = 4 12 正好可以被 4 整除所以说明有重复的子字符串asdf
C++代码如下:(这里使用了前缀表统一减一的实现方式) C++代码如下:(这里使用了前缀表统一减一的实现方式)