Module aoc::year2022::day01

source ·
Expand description

§Calorie Counting

Sums groups of numbers separated by blank lines into an 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 and group lines.
  • Use a reverse iterator to find the elf with the most calories.
  • Use a reverse iterator to sum the calories of the 3 highest elves.