Expand description
This is my solution for Advent of Code - Day 2: Red-Nosed Reports
parse_input
uses parse_report
to turn the input file into Vec<Report>
. first_bad_level_pair
is used
by both parts to find the first pair that causes the report to be unsafe. analyse_reports
solves part 1.
report_check_with_dampener
applies the more relaxed check for part 2, trying the permutations of dropping a
level that might allow the report to pass. analyse_reports_with_dampener
uses that to get the part 2 solution.
FunctionsΒ§
- analyse_
reports πSolves part 1, counting all the reports that are safe as is - Solves part 1, counting all the reports that are safe after dampening
- first_
bad_ πlevel_ pair Find the first pair in the report that either: - parse_
input πParse the input file into a list of reports - parse_
report πParse a line of input as a list of levels - If the report is unsafe, it can be considered safe enough if it becomes safe when removing one level.
- The entry point for running the solutions with the βrealβ puzzle input.
- without_
index πReturns a copy of the input report without the level at the specified index
Type AliasesΒ§
- Report π