Module day04

Module day04 

Source
Expand description

§Printing Department

To speed things up, we build a queue of rolls to be removed. For part one, the length of the initial list is the answer. For part two, as we remove rolls from the list one at a time, we update neighboring rolls. If any neighbor drops below the threshold, then we add it to the list. This approach avoids a time-consuming scan of the entire grid to find new rolls to remove.

Either breadth-first search using a VecDeque or depth-first search using a Vec will work. The depth-first search is faster, so we choose that.

Functions§

parse
part1
part2

Type Aliases§

Input 🔒