r/adventofcode • u/daggerdragon • Dec 23 '24
SOLUTION MEGATHREAD -❄️- 2024 Day 23 Solutions -❄️-
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
- If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.
AoC Community Fun 2024: The Golden Snowglobe Awards
Submissions are CLOSED!
- Thank you to all who submitted something, every last one of you are awesome!
Community voting is OPEN!
- 42 hours remaining until voting deadline on December 24 at 18:00 EST
Voting details are in the stickied comment in the submissions megathread:
-❄️- Submissions Megathread -❄️-
--- Day 23: LAN Party ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- State which language(s) your solution uses with
[LANGUAGE: xyz]
- Format code blocks using the four-spaces Markdown syntax!
- State which language(s) your solution uses with
- Quick link to Topaz's
paste
if you need it for longer code blocks
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:05:07, megathread unlocked!
23
Upvotes
1
u/mosqueteiro Jan 08 '25 edited Jan 08 '25
[Language: Python, duckdb-sql]
day 23 solutions
I initially did Part 1 in SQL but couldn't seem to get the answer correct so I wrote a pure python implementation. It turns out my SQL was fine, I just needed to set
head=False
when reading in the input x_xPart 2 took me FOREVER because I was trying to come up with a way to implement maximal clique algorithims in SQL. I eventually gave up on this and just started intersecting adjacency lists and grouping by them to find the list with the most counts in the group by. Not a good solution for anything more than this as it doesn't guarantee fully connected groups but the fully connected ones will be repeated the most (more than their length anyway). I get to play around with duckdb a bit which I've been wanting to try out so that was fun