Skip to content

Commit c817a85

Browse files
nhantran0jakobkogler
authored andcommitted
Fixed indices of substrings comparator (#271)
1 parent 5eabf37 commit c817a85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/string/suffix-array.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ See for instance the article about the [Sparse Table](./data_structures/sparse-t
257257

258258
```cpp
259259
int compare(int i, int j, int l, int k) {
260-
pair<int, int> a = {c[k][i], c[k][(i+1-(1 << k))%n]};
261-
pair<int, int> b = {c[k][j], c[k][(j+1-(1 << k))%n]};
260+
pair<int, int> a = {c[k][i], c[k][(i+l-(1 << k))%n]};
261+
pair<int, int> b = {c[k][j], c[k][(j+l-(1 << k))%n]};
262262
return a == b ? 0 : a < b ? -1 : 1;
263263
}
264264
```

0 commit comments

Comments
 (0)