mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-07-05 00:23:59 +08:00
README fixes.
This commit is contained in:
@ -43,7 +43,7 @@ export default function knuthMorrisPratt(text, word) {
|
||||
if (text[textIndex] === word[wordIndex]) {
|
||||
// We've found a match.
|
||||
if (wordIndex === word.length - 1) {
|
||||
return textIndex - word.length + 1;
|
||||
return (textIndex - word.length) + 1;
|
||||
}
|
||||
wordIndex += 1;
|
||||
textIndex += 1;
|
||||
|
Reference in New Issue
Block a user