Skip to content

Commit 0f8e5bd

Browse files
authored
nit (#97)
Co-authored-by: Luke Videckis <lukevideckis@gmail.com>
1 parent 43248da commit 0f8e5bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/monotonic/count_rects.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ pub fn count_rects(grid: &[Vec<bool>]) -> Vec<Vec<i32>> {
4343
let le = mono_st(&h, |x, y| x.lt(y));
4444
let ri = mono_range(&le);
4545
for j in 0..m {
46-
let (cnt_l, cnt_r) = (j - le[j].wrapping_add(1), ri[j] - j - 1);
47-
cnt[h[j]][cnt_l + cnt_r + 1] += 1;
48-
cnt[h[j]][cnt_l] -= 1;
49-
cnt[h[j]][cnt_r] -= 1;
46+
let (cnt_l, cnt_r) = (j.wrapping_sub(le[j]), ri[j] - j);
47+
cnt[h[j]][cnt_l + cnt_r - 1] += 1;
48+
cnt[h[j]][cnt_l - 1] -= 1;
49+
cnt[h[j]][cnt_r - 1] -= 1;
5050
}
5151
}
5252
for row in cnt.iter_mut().skip(1) {

0 commit comments

Comments
 (0)