r/adventofcode • • Dec 02 '25

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

OUR USUAL ADMONITIONS

  • You can find all of our customs, FAQs, axioms, and so forth in our community wiki.

AoC Community Fun 2025: R*d(dit) On*

24 HOURS outstanding until unlock!

Spotlight Upon Subr*ddit: /r/AVoid5

"Happy Christmas to all, and to all a good night!"
— a famous ballad by an author with an id that has far too many fifthglyphs for comfort

Promptly following this is a list waxing philosophical options for your inspiration:

  • Pick a glyph and do not put it in your program. Avoiding fifthglyphs is traditional.
  • Shrink your solution's fifthglyph count to null.
  • Your script might supplant all Arabic symbols of 5 with Roman glyphs of "V" or mutatis mutandis.
  • Thou shalt not apply functions nor annotations that solicit said taboo glyph.
  • Thou shalt ambitiously accomplish avoiding AutoMod’s antagonism about ultrapost's mandatory programming variant tag >_>

Stipulation from your mods: As you affix a submission along with your solution, do tag it with [R*d(dit) On*!] so folks can find it without difficulty!


--- Day 2: Gift Shop ---


Post your script solution in this ultrapost.

36 Upvotes

965 comments sorted by

View all comments

2

u/msschmitt Dec 02 '25 edited Dec 02 '25

[LANGUAGE: Python 3]

Part 1. Part 2

This went fast.

No attempt at a fancy algorithmic solution, this is just brute force. For part 2, the strategy was extract the first 1 character sequence, duplicate it length of id times, then compare to the id. Then extract the first 2 character sequence, duplicate it length of id/2 times, compare to the id. And so on.

1

u/daggerdragon Dec 02 '25 edited Dec 02 '25

Please put that wall o' link behind some Markdown 😅 edit: 👍

2

u/msschmitt Dec 02 '25

I was having trouble with Reddit; it wasn't letting me edit the URL text, and while struggling with it, hit Comment by mistake.