Advent of Code 2024 Day 23 (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 23 of the Advent of Code - https://adventofcode.com/2024/day/23
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Another easy problem! This AoC has been an excellent one. Elegant problems with just the right amount of challenge:
For Part 2, we already have a head start since we just calculated all groups of size 3, and an iterative macro comes in handy to build from there by Joining to input data, checking if any values are connected to all values in pre-established group, adding to the group if true, and then repeating the process:
- 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
It took me a little while to understand the problem statement.
For P1, I used a purely brute force approach. First, all possible three PC combinations were created, then searched for the ones that satisfied the conditions.
For P2, I added one computer at a time to the sets of three identified in P1. However, as the number of loops increased, the amount of data exploded. To address this, grouping were implemented
During this process, combinations like A, B, C, F, D, E and A, B, C, E, F, D would appear, so I temporarily split them, sorted the elements, and standardized them to A, B, C, D, E, F for grouping. This helped prevent the number of records from growing uncontrollably.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Solved!
Viz
 
And then, if the column "name" and "3" have the same value, they are interconnected. All you need to do is include the first letter 't' and eliminate the duplicates.
Part 2 starts with the three interconnection lists created in Part 1. Add one node that seems to be connectable to this list and check whether it can be interconnected with the PC in the interconnection list. If it can be connected, add it as the new interconnection list. This is repeated until the longest list is reached where no more can be added. The number of iterations was about 10.
Part2 macro
- 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
Day 23. More in spoiler
P2: I think I got lucky cause I just built out the grid from P1 like the example, sorted by most children under parent and got the answer quick without a macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My solution.
Part 2 takes 8.2 sec.
 
  
I found a network name that can be connected to all of the current networks as shown in the image.
This was found by number of joins = number of iterations.
In the first iteration, the AB-CD network can be joined by XX, which has connections to both AB and CD.
In the second iteration, the network must have connections to AB, CD, and XX.
Repeat this process.
Since Input has left and right sides (xx-yy), i also created a reversed record (xx-yy and yy-xx).
Since there are more records, we sorted them each time to limit the number of unique records.
The start of my workflow is started with all records, so I think this could be executed more faster if I could start with the proper starting method. However, I don't know exactly how to implement this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
my part2 is faster than part1. 🤣
re-create macro for all combination generator. but it super slows in 13 from 14 and 3 from 52....
1. join once to get 1,2,3
2. remove not "t"
3. sort and remove duplicate combination
4. verified the each 2 pairs.
5. if all matched mean it valid combination
part2:
it assumes answer are 13. because each LAN are link with other 13 exactly, same to sample also link 4 LAN exactly
i sense it may the answer,
so just create a macro to remove one of it rotate-ly and validate each set of 13 (13 + its own - 1). if all combination matched, then it is the answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I created WF that I don't wanna explain about it to others😂
Network Analysis tools helps us to understand the data structure.
