Advent of Code 2024 Day 5 (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 5 of the Advent of Code - https://adventofcode.com/2024/day/5
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day 5 P2 was an challenging task for me. Regarding P2, I referred to @Samantha_Jayne 's workflow. Her workflow was truly outstanding and something I couldn't replicate.
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This was a tough one.... the way i did it for P1 wouldnt work for P2 so need to rethink design.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Samantha_Jayne
This is so elegant. Thank you for sharing.
I went to complete oposite direction as Max Macro, Batch + Iterative.
I have downloaded your flow for leaning.
AoC is all about the logic, I guess.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Samantha_Jayne
Can I have a question about your flow?
The questions states below
(47 doesn't necessarily need to be immediately before 53; other pages are allowed to be between them.)
But in your "Rule in Input" variable, it appears that your assume that the pages are always immediately next to each other.
I did run my data, and your workflow is actually giving the correct answer.
I am really wondering why. can you enlighten me? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sorry spoilers and I can't put it in a box on my phone!!
From memory, not in front of my computer and I promised I would write it up properly as it was a bit of a genius mind this morning that I'm not used to.
So I've appended all the possible combinations using the append tool.
Then I know how many matches are required per group to ensure that I have all the pages. Calculated in the formula tool.
Find the combination with all the matches, then count the middle option for them.
I was surprised it worked too. Hope that helps.
Alteryx
#alteryxrocks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Finally got this one figured out!
I solved Part 1 by checking each page number in the update against each rule relevant to that page number, and comparing the index of one against the other.
I got extremely stuck on Part 2, and didn't have time to give it much thought before tonight. Luckily, I think the mental break is what I needed. I realized that I don't actually need to reorder anything, I just needed to identify which element was in the MIDDLE. Luckily, every instruction set had one page number that by definition had to be in the middle!
I'm eager to see everyone else's elegant solutions, and to give thought to reworking this one. This wasn't my favorite but it was a good challenge.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This was a lesson in walking away and coming back with fresher eyes. Sometimes it helps to stop and ask - what do I really need to do here.
Alas - no fancy macros or iterations. The result may not be completely robust but it got the job done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Solved! For Part 2, I was struggling with how to proactively figure out the right order. After futzing with it for awhile, I gave up and went with an iterative macro inside of another iterative macro.
In the inner iterative macro, I started at the left of each "update" and checked to see if page 1 and page 2 were in a good or bad order. If bad, I switched. If good, I left alone. Then I checked if the entire line was resolved. If not, I checked page 2 against page 3. And then for any where I got to the end and they still had problems, I sent them back through the inner iterative macro, and just repeated until they were in the right order.
Definitely not the most efficient way to solve it, but the entire workflow runs in 3.1 seconds so I'm calling that good enough :)
Outer macro:
Inner macro:
