Skip to content

Commit

Permalink
be fancy
Browse files Browse the repository at this point in the history
  • Loading branch information
mflinn-broad committed Dec 16, 2021
1 parent 246e7a7 commit f73d7a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/days/day14.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use itertools::{Itertools, MinMaxResult};

use crate::util;
use std::collections::HashMap;

Expand Down Expand Up @@ -45,10 +47,12 @@ fn polymer_strength(input: Input, steps: usize) -> usize {
new_pairs
});

let min = singles.values().min().unwrap();
let max = singles.values().max().unwrap();
if let MinMaxResult::MinMax(min, max) = singles.values().minmax() {
max - min
} else {
0
}

max - min
}

fn process(input: &str) -> Input {
Expand Down

0 comments on commit f73d7a1

Please sign in to comment.