advent_of_code_2024

Module day_3

source
Expand description

This is my solution for Advent of Code - Day 3: Mull It Over

Most of today’s heavy lifting is done by the parser extract_instructions. Part one is solved by sum_muls which cherry-picks all the Mul instructions. sum_instructions extends that by respecting Do and Dont instructions.

EnumsΒ§

  • Instruction πŸ”’
    The possible instructions that can be extracted from the input string

FunctionsΒ§

  • Uses a [Regex] to extract specific Instructions from the input string.
  • Helper for parsing a specified Regex capturing group as a number
  • The entry point for running the solutions with the β€˜real’ puzzle input.
  • sum_instructions πŸ”’
    Solution to part 1. Sums the results of applying only Mul instructions that are not disabled by Dont instructions.
  • sum_muls πŸ”’
    Solution to part 1. Sums the results of applying all Mul instructions