cargo fmt
parent
14b0294282
commit
408a690061
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use std::fs;
|
||||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
|
||||
fn get_priority(t: &char) -> u32 {
|
||||
if t.is_ascii_uppercase() {
|
||||
|
@ -47,14 +47,20 @@ pub fn run() -> Result<()> {
|
|||
let elf2map: HashSet<char> = HashSet::from_iter(elf2.chars());
|
||||
let elf3map: HashSet<char> = HashSet::from_iter(elf3.chars());
|
||||
|
||||
for dupe in elf1map.iter().filter(|t| elf2map.contains(t) && elf3map.contains(t)) {
|
||||
for dupe in elf1map
|
||||
.iter()
|
||||
.filter(|t| elf2map.contains(t) && elf3map.contains(t))
|
||||
{
|
||||
rucksacks2.push(get_priority(dupe));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
println!("part two priorities {}", rucksacks2.into_iter().sum::<u32>());
|
||||
println!(
|
||||
"part two priorities {}",
|
||||
rucksacks2.into_iter().sum::<u32>()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue