Skip to content

Commit b2f1c6d

Browse files
authored
Update LCP calculation to use min function
1 parent 68349dd commit b2f1c6d

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
@@ -35,7 +35,7 @@ auto sa_short(const auto& s) {
3535
}
3636
}
3737
} else {
38-
lcp[i] = j * K;
38+
lcp[i] = min({j * K, n - sa[i], n - sa[i + 1]});
3939
}
4040
}
4141
}

0 commit comments

Comments
 (0)