From: Greg Burri Date: Sun, 11 Dec 2022 12:21:42 +0000 (+0100) Subject: Simplification X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=1c800c706f41b9e5f9222316b33f244c79156dd0;p=advent_of_code_2022.git Simplification --- diff --git a/src/day11.rs b/src/day11.rs index 9ad00bd..75a64af 100644 --- a/src/day11.rs +++ b/src/day11.rs @@ -85,8 +85,7 @@ pub fn run(monkeys: &mut [Monkey], nb_rounds: u64, worry_divided: u64) -> u64 { } } - let most_inspected_items: Vec<&u64> = inspected.iter().sorted().rev().take(2).collect(); - most_inspected_items[0] * most_inspected_items[1] + inspected.iter().sorted().rev().take(2).product() } #[cfg(test)]