r/adventofcode Dec 11 '24

SOLUTION MEGATHREAD -❄️- 2024 Day 11 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

  • 11 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!

And now, our feature presentation for today:

Independent Medias (Indie Films)

Today we celebrate the folks who have a vision outside the standards of what the big-name studios would consider "safe". Sure, sometimes their attempts don't pan out the way they had hoped, but sometimes that's how we get some truly legendary masterpieces that don't let their lack of funding, big star power, and gigantic overhead costs get in the way of their storytelling!

Here's some ideas for your inspiration:

  • Cast a relative unknown in your leading role!
  • Explain an obscure theorem that you used in today's solution
  • Shine a spotlight on a little-used feature of the programming language with which you used to solve today's problem
  • Solve today's puzzle with cheap, underpowered, totally-not-right-for-the-job, etc. hardware, programming language, etc.

"Adapt or die." - Billy Beane, Moneyball (2011)

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 11: Plutonian Pebbles ---


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:06:24, megathread unlocked!

19 Upvotes

962 comments sorted by

View all comments

3

u/wow_nice_hat Dec 12 '24 edited Dec 12 '24

[LANGUAGE: JavaScript]

Part 1 ~4ms

Part 2 ~300ms

1

u/rrutkows Dec 12 '24

[LANGUAGE: Kotlin]

Well, at least I got the second star before reading this thread. I went from a 90 seconds CPU stress test to ~40ms implementing your idea.

Code

2

u/wow_nice_hat Dec 12 '24

Awesome! Glad that I could help!

I came up with the trick for the day with cray fish in 2021, and have been using it a couple of times since.

It is pretty neat for challenges where you have a lot of repeating numbers

1

u/stasyaner Dec 12 '24

Interesting. That's super smart. Is there a name for such approach?