Advent of Code 2024 Day 11 (BaseA Style)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 11 of the Advent of Code - https://adventofcode.com/2024/day/11
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
today challenge remind me about 2021 day 6 challenge. It look alike.
regex_replace([data],"\(d{"+tostring([length]/2)+"})(\d+)","$1|$2")
part2:
tips: group by
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Absolutely loved this problem. Part 2 took me a few minutes to realize the trick that changes the problem from being unsolvable to being a walk in the park (Glad I got to use some interface tools this time!):
Main Workflow:
Blink (Iterative Macro):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Need some trick on part2 to finish calculation.
Part2: If there are 2 or more stones having the same number, they shall be grouped into one and sum up their count, and remember that count. As the stones having the same number will transform in the same way at next blink, no need to evaluate them separately. Repeat 'grouping and summing up count' process until 75 times of blink.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Solved!
Today is straightforward, too.
Part 1 macro
Part 2 macro
Part 2 was needed a little minor change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Got hint from here. 😁
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Took me longer than I wish to admit to figure out the trick to part two, and also just let it run in the blind hope it would be fine, knowing that it wouldn't be...
Got there in the end!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Spent 10 minutes iterating with the same macro for Part 2, with my computer sounding like it was going to take off before I worked it out! Ran in 1.5 seconds for part 1 and 2.
Spoilers ahead:
Part 1 simple iterative macro increasing record count over 25 iterations:
Part 2, added Grouping logic and kept a record of how many times a number exists in the data. This massively reduced processing time as the number of records do not balloon as they do with the first macro.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My workflow is not good...
There are many occurrences of numbers 0-9. for 0-9, the results were combined after 5 blinks.
Results other than 0-9 were blinked 5 times.
This was repeated 15 times (5*15).
So my workflow has macro nesting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 11 & another 2 stars down! Despite my defiance in the WhatsApp group, I did indeed end up optimising this in order to save my laptop.
