Skip to content

Commit

Permalink
nit (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: Luke Videckis <[email protected]>
  • Loading branch information
lrvideckis and lrvideckis authored Jul 28, 2024
1 parent d455276 commit 817bfa9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/data_structures/lazy_seg_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ impl LazySegTree {
/// - Space: O(n)
pub fn build_on_array(a: &[u64]) -> Self {
let n = a.len();
let mut pw2 = 1;
while pw2 < n {
pw2 *= 2;
}
let mut tree = vec![0; 2 * n];
let pw2 = n.next_power_of_two();
for i in 0..n {
tree[(i + pw2) % n + n] = a[i];
}
Expand Down

0 comments on commit 817bfa9

Please sign in to comment.