Skip to content

Commit

Permalink
Fix SA LCP
Browse files Browse the repository at this point in the history
  • Loading branch information
oToToT authored Feb 10, 2024
1 parent 6ec50c1 commit dc44be3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codes/String/SuffixArrayTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ template <int LG = 20> struct SparseTableSA : Suffix {
}
int lcp(int a, int b) {
if (a == b) return n - a;
a = rev[a]; b = rev[b];
a = rev[a] + 1, b = rev[b] + 1;
if (a > b) swap(a, b);
const int lg = __lg(b - a);
return min(mn[lg][a], mn[lg][b - (1 << lg)]);
Expand Down

0 comments on commit dc44be3

Please sign in to comment.