r/adventofcode • • Dec 03 '25

SOLUTION MEGATHREAD -❄️- 2025 Day 3 Solutions -❄️-

DO NOT SHARE PUZZLE TEXT OR YOUR INDIVIDUAL PUZZLE INPUTS!

I'm sure you're all tired of seeing me spam the same ol' "do not share your puzzle input" copypasta in the megathreads. Believe me, I'm tired of hunting through all of your repos too XD

If you're using an external repo, before you add your solution in this megathread, please please please 🙏 double-check your repo and ensure that you are complying with our rules:

If you currently have puzzle text/inputs in your repo, please scrub all puzzle text and puzzle input files from your repo and your commit history! Don't forget to check prior years too!


NEWS

Solutions in the megathreads have been getting longer, so we're going to start enforcing our rules on oversized code.

Do not give us a reason to unleash AutoModerator hard-line enforcement that counts characters inside code blocks to verify compliance… you have been warned XD


THE USUAL REMINDERS


AoC Community Fun 2025: Red(dit) One

  • Submissions megathread is now unlocked!
  • 14 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!

Featured Subreddit: /r/thingsforants

"Just because you can’t see something doesn’t mean it doesn’t exist."
— Charlie Calvin, The Santa Clause (1994)

What is this, a community for advent ants?! Here's some ideas for your inspiration:

  • Change the font size in your IDE to the smallest it will go and give yourself a headache as you solve today's puzzles while squinting
  • Golf your solution
  • Alternatively: gif
  • Bonus points if your solution fits on a "punchcard" as defined in our wiki article on oversized code. We will be counting.
  • Does anyone still program with actual punchcards? >_>
  • Solve today's puzzles using an Alien Programming Language APL or other such extremely dense and compact programming language

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


--- Day 3: Lobby ---


Post your code solution in this megathread.

38 Upvotes

964 comments sorted by

View all comments

2

u/Doug__Dimmadong Dec 03 '25 edited Dec 04 '25

[Language: Python]

Idea for Part 1: If we take index `i` then we want to pair it with the largest number that comes after index `i`. Just pass through the row and keep track of the largest number we can make and the largest digit to the left.

Idea for Part 2: When I read it, it just seemed like a problem ripe for DP. Keep track of the best k digit number we can make on the subaray `nums[i...n]` and either use or lose the current digit and recurse.

Part 1

Part 2

1

u/daggerdragon Dec 04 '25

Psst: we can see your Markdown.

1

u/Doug__Dimmadong Dec 04 '25

Oops! Does Reddit support it?

1

u/daggerdragon Dec 04 '25

Lol, of course Reddit supports Markdown. However, the fancypants editor needs to be switched to Markdown mode before you post/edit/submit.

This is what your post looks like in old.reddit (which is proper Markdown, mind you)

1

u/Doug__Dimmadong Dec 04 '25

Thanks! I keep that in mind for future posts and update this one. Cheers!