Module day01

Source
Expand description

§Calorie Counting

Sums groups of numbers separated by blank lines into a vec sorted in ascending order.

Since we don’t care what order the highest values are returned in select_nth_unstable would also work, and in theory is a little faster, however the difference was negligible when benchmarking.

Functions§

parse
Parse and group lines.
part1
Use a reverse iterator to find the elf with the most calories.
part2
Use a reverse iterator to sum the calories of the 3 highest elves.