From: Greg Burri Date: Sun, 11 Dec 2022 12:21:42 +0000 (+0100) Subject: Simplification X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=0b4b5e9b1dee97876976307fb0dd49d4b4da373e;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)]