Skip to content

Commit 40bd41c

Browse files
Update BoyerMoore.js | Lgtm alert fix.
1 parent 508f38d commit 40bd41c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

String/BoyerMoore.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ const boyerMoore = (str, pattern) => {
2626
const badMatchTable = buildBadMatchTable(pattern)
2727
let offset = 0
2828
const patternLastIndex = pattern.length - 1
29-
let scanIndex = patternLastIndex
3029
const maxOffset = str.length - pattern.length
3130
// if the offset is bigger than maxOffset, cannot be found
3231
while (offset <= maxOffset) {
33-
scanIndex = 0
32+
let scanIndex = 0
3433
while (pattern[scanIndex] === str[scanIndex + offset]) {
3534
if (scanIndex === patternLastIndex) {
3635
// found at this index

0 commit comments

Comments
 (0)