2025(02): solve part 2

Grafpuzzels zijn het soms.
This commit is contained in:
2025-12-02 09:10:51 +01:00
parent 0a96499f76
commit 1e01c9ee38
2 changed files with 88 additions and 0 deletions

View File

@ -41,3 +41,27 @@ Your job is to find all of the invalid IDs that appear in the given ranges. In t
Adding up all the invalid IDs in this example produces _`1227775554`_.
_What do you get if you add up all of the invalid IDs?_
### Part Two
The clerk quickly discovers that there are still invalid IDs in the ranges in your list. Maybe the young Elf was doing other silly patterns as well?
Now, an ID is invalid if it is made only of some sequence of digits repeated _at least_ twice. So, `12341234` (`1234` two times), `123123123` (`123` three times), `1212121212` (`12` five times), and `1111111` (`1` seven times) are all invalid IDs.
From the same example as before:
* `11-22` still has two invalid IDs, _`11`_ and _`22`_.
* `95-115` now has two invalid IDs, _`99`_ and _`111`_.
* `998-1012` now has two invalid IDs, _`999`_ and _`1010`_.
* `1188511880-1188511890` still has one invalid ID, _`1188511885`_.
* `222220-222224` still has one invalid ID, _`222222`_.
* `1698522-1698528` still contains no invalid IDs.
* `446443-446449` still has one invalid ID, _`446446`_.
* `38593856-38593862` still has one invalid ID, _`38593859`_.
* `565653-565659` now has one invalid ID, _`565656`_.
* `824824821-824824827` now has one invalid ID, _`824824824`_.
* `2121212118-2121212124` now has one invalid ID, _`2121212121`_.
Adding up all the invalid IDs in this example produces _`4174379265`_.
_What do you get if you add up all of the invalid IDs using these new rules?_