diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-12-20 08:11:41 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-12-20 08:11:41 +0200 |
commit | db68326ff25db8aa69a6fb1ba7375d1205e48a7f (patch) | |
tree | ee169ec485b0418d6978fb6d07ceea865929086e /src | |
parent | 0f849e3cb183860890b672f2977996dfa486ca35 (diff) |
More targeted dedup on day 20
Diffstat (limited to 'src')
-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); |