This commit is contained in:
Yash Karandikar 2022-12-01 15:53:42 -06:00
commit 93936f936c
2 changed files with 2253 additions and 0 deletions

16
one.rs Normal file
View file

@ -0,0 +1,16 @@
fn main() {
let buf = std::fs::read_to_string("one.txt").unwrap();
let mut elves: Vec<u32> = buf
.split("\n\n")
.map(|s| {
s.trim()
.split("\n")
.map(|n| n.trim().parse::<u32>().unwrap())
.sum()
})
.collect();
elves.sort_unstable_by(|a, b| b.cmp(a));
println!("{}", elves[0]);
println!("{}", elves.into_iter().take(3).sum::<u32>());
}

2237
one.txt Normal file

File diff suppressed because it is too large Load diff