Skip to content

Commit 3ffb893

Browse files
authored
Fix LCP calculation in suffix array implementation
1 parent 76cc0f9 commit 3ffb893

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/strings/suffix_array/suffix_array_short.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ auto sa_short(const auto& s) {
3030
sa_inv[sa[i + 1]]++;
3131
rep (k, 0, K) {
3232
if (f(sa[i + 1])[k] != f(sa[i])[k]) {
33-
lcp[i] = j * k + (sa[i] + j * k < n ? y[sa_inv[sa[i] + j * k]] : 0);
33+
lcp[i] = j * k + (sa[i] + j * k < n ? y[x[sa[i] + j * k]] : 0);
3434
}
3535
}
3636
} else {

0 commit comments

Comments
 (0)