nicer with reverse
This commit is contained in:
parent
3704179238
commit
1d58f1e24c
|
@ -24,9 +24,7 @@ pub fn part_2(input: &String) -> u64 {
|
|||
}).collect();
|
||||
|
||||
elf_calorie_counts.sort_unstable();
|
||||
elf_calorie_counts.reverse();
|
||||
|
||||
let start = elf_calorie_counts.len() - 3;
|
||||
let top_3 = elf_calorie_counts.drain(start..);
|
||||
|
||||
top_3.sum()
|
||||
elf_calorie_counts.iter().take(3).sum()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue