From db68326ff25db8aa69a6fb1ba7375d1205e48a7f Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 20 Dec 2018 08:11:41 +0200 Subject: More targeted dedup on day 20 --- src/bin/day_20.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/bin/day_20.rs b/src/bin/day_20.rs index b9706d5..6486d72 100644 --- a/src/bin/day_20.rs +++ b/src/bin/day_20.rs @@ -49,8 +49,6 @@ fn populate_rooms(input: &str) -> HashMap<(i32, i32), Room> { let mut coord_stack: Vec<(Vec<(i32, i32)>, Vec<(i32, i32)>)> = Vec::new(); for c in input.chars() { - coords.sort(); - coords.dedup(); match c { '^' | '$' => {}, 'E' => { @@ -91,6 +89,8 @@ fn populate_rooms(input: &str) -> HashMap<(i32, i32), Room> { ')' => { coord_stack.last_mut().unwrap().1.append(&mut coords); coords = coord_stack.pop().unwrap().1; + coords.sort(); + coords.dedup(); }, c => { panic!("Unknown character {}", c); -- cgit v1.2.3