master
ehlxr 2022-03-13 16:26:12 +08:00
parent 09d2c4899b
commit db57411ca1
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ public class Kmp {
} else {
// 当模式串与主串不匹配时,如果**不匹配字符**对应模式串下标大于 j > 0 (非首个模式串字符)
// 并且此字符前一个字符对应字符串部分匹配表中的值 next[j - 1] 也大于 0
// 模式串后移到 next[j - 1] 位置
// j - next[j - 1] 即模式串为后移的位数,等价于 j 置为 next[j - 1]
if (j > 0 && next[j - 1] > 0) {
j = next[j - 1];
} else {