From fa89fb1fdf866d06a7b47f292b7c0b70e9955a03 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 27 Jul 2024 23:49:56 -0500 Subject: [PATCH] nit --- src/data_structures/lazy_seg_tree.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/data_structures/lazy_seg_tree.rs b/src/data_structures/lazy_seg_tree.rs index 406315d9..509b6f2e 100644 --- a/src/data_structures/lazy_seg_tree.rs +++ b/src/data_structures/lazy_seg_tree.rs @@ -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]; }