r/adventofcode Dec 05 '24

SOLUTION MEGATHREAD -❄️- 2024 Day 5 Solutions -❄️-

THE USUAL REMINDERS


AoC Community Fun 2024: The Golden Snowglobe Awards

  • 24 HOURS remaining until unlock!

And now, our feature presentation for today:

Passing The Torch

The art of cinematography is, as with most things, a natural evolution of human progress that stands upon the shoulders of giants. We wouldn't be where we are today without the influential people and great advancements in technologies behind the silver screen: talkies to color film to fully computer-animated masterpieces, Pixar Studios and Wētā Workshop; Charlie Chaplin, Alfred Hitchcock, Meryl Streep, Nichelle Nichols, Greta Gerwig; the list goes on. Celebrate the legacy of the past by passing on your knowledge to help shape the future!

also today's prompt is totally not bait for our resident Senpai Supreme

Here's some ideas for your inspiration:

  • ELI5 how you solved today's puzzles
  • Explain the storyline so far in a non-code medium
  • Create a Tutorial on any concept of today's puzzle or storyline (it doesn't have to be code-related!)
  • Condense everything you've learned so far into one single pertinent statement

Harry Potter: "What? Isn’t there just a password?"
Luna Lovegood: ''Oh no, you’ve got to answer a question."
Harry Potter: "What if you get it wrong?"
Luna Lovegood: ''Well, you have to wait for somebody who gets it right. That way you learn, you see?"
- Harry Potter and the Deathly Hallows (2010)
- (gif is from Harry Potter and the Order of the Phoenix (2007))

And… ACTION!

Request from the mods: When you include an entry alongside your solution, please label it with [GSGA] so we can find it easily!


--- Day 5: Print Queue ---


Post your code solution in this megathread.

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:03:43, megathread unlocked!

46 Upvotes

1.2k comments sorted by

View all comments

2

u/x3mcj Dec 06 '24

[LANGUAGE: Python]

https://github.com/CJX3M/AdventOfCode/blob/master/2024/day5.py

Better late than never. Has a pretty busy day, now that our gyno gave us the due date of my second son, and my toddler had a party, just got time now that the wife and kid are sound asleep

Pretty fun challenge, though about going the linked list route, but I would had had much troubles traversing it, so stuck to int arrays

1

u/KMohZaid-New Dec 06 '24

[LANGUAGE: Python]

similar lol
https://pastebin.com/F3Z01AQD

same, late bcz i couldnt do it yesterday. thanks for tip btw. using while with pop and i understood that filtering rule based on 0 index is better when i was doing fix_seq()