We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e43234d commit a837375Copy full SHA for a837375
library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp
@@ -14,7 +14,7 @@ int walk(int l, int r, const auto& f) {
14
}
15
*/
16
int good=0;
17
- while (l <= r) {
+ while (l <= r-good) {
18
int u = l + n, x = __lg(min(u & -u, r - l +1-good));
19
if (f(s[u >> x])) good=1,r = l + (1 << x) - 1;
20
else l += 1 << x;
0 commit comments