diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/day_20.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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); |