Add solution for "Day 2: Gift Shop", part 2
This commit is contained in:
@@ -16,6 +16,14 @@ This project does not contain the puzzle or example inputs as per the [copyright
|
||||
|
||||
For this one, we are moving around a dial with some not too complicated modulo calculations.
|
||||
|
||||
### Day 2: Gift Shop
|
||||
|
||||
:mag_right: Puzzle: <https://adventofcode.com/2025/day/2>, :white_check_mark: Solver: [`GiftShop`](src/solvers/gift_shop.rs)
|
||||
|
||||
Firstly, we calculate directly the sum of invalid IDs composed of two identical sequences of digits for part 1. This can easily be generalized for any number of repetitions of sequences. However, the problem is to avoid adding certain invalid IDs to the sum multiple times. Therefore we only check prime numbers of repetitions, and take care that invalid IDs that are composed of a repetition of a single digit are only counted once.
|
||||
|
||||
On top of that we use a cache to avoid recalculating prime factors and certain helper variables for given ID lengths and repetition counts.
|
||||
|
||||
### Day 4: Printing Department
|
||||
|
||||
:mag_right: Puzzle: <https://adventofcode.com/2025/day/4>, :white_check_mark: Solver: [`PrintingDepartment`](src/solvers/printing_department.rs)
|
||||
|
||||
Reference in New Issue
Block a user