From 0b4b5e9b1dee97876976307fb0dd49d4b4da373e Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Sun, 11 Dec 2022 13:21:42 +0100 Subject: [PATCH] Simplification --- src/day11.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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)] -- 2.45.2