Skip to content

Commit 5743f65

Browse files
authored
Reverse conditions in walk function logic
1 parent 8ea2e9e commit 5743f65

File tree

1 file changed

+2
-2
lines changed
  • library/data_structures_[l,r]/seg_tree_uncommon

1 file changed

+2
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
int walk(int l, int r, const auto& f) {
22
while (l <= r) {
33
int u = l + n, x = __lg(min(u & -u, r - l + 1));
4-
if (f(s[u >> x])) r = l + (1 << x) - 2;
5-
else l += 1 << x;
4+
if (f(s[u >> x])) l += 1 << x;
5+
else r = l + (1 << x) - 2;
66
}
77
return l;
88
}

0 commit comments

Comments
 (0)