Discussion thread for day 19 of the Advent of Code - https://adventofcode.com/2024/day/19
I like this kind of puzzle.
Simple problem if you utilize a critical optimization (otherwise very difficult problem) ((also a remarkably elegant solution)):
Today's problem was fairly simple once I figured out the approach.
The task is to remove characters one by one from the beginning, and it's complete when all characters have been removed.
Since the number of records increases over time, I grouped them within the Iteration Macro.
That was a good one, with an excellent data science lesson tucked in.
No workflow because it was basically scratch paper.
I really appreciate how this type of advent problem reminds you that problems exist that can't be solved with compute cycles alone.
Once I got my head out of thinking I needed to go down crazy nested macro paths I realized this actually wasn't too bad at all... and the added bonus of really only needing to add a count field to then sum in my existing part 1 macro to get to the part 2 solution was a nice cherry on top.
I nailed it quickly today!
Day 19 done! At the point of only tackling 'quicker' days now so was pleased to see this one when I logged on. Did get stuck on p2 a bit as I'd took a different approach with my macro originally, using a join/union to remove towels that already had a valid solution. After making some changes, a quick peek at @Hub119's macro made me realise I was over-grouping in the final Summarize between iterations!
Solved!
Part 1 macro
Part 2 macro
I was so caught up in the thoughts in Part 1 that I had a hard time coming up with an answer for Part 2.
And I used the ReplaceFirst! I love simple function!
Day 19. More in spoiler