r/adventofcode • u/Just-Routine-5505 • Dec 03 '25
Visualization [2025 Day 03] CLI Visualization
I visualized my greedy solution for Advent of Code Day 3. The animation shows a sliding window selecting the next maximum digit while ensuring enough characters remain to reach the required output length. Blue = current window, Red = remaining-picks region, Green = chosen max.The number builds step-by-step from left to right.
This works for both parts of the problem
Edit:
Another example with longer input: https://imgur.com/a/MLghbhk (i couldn't add another gif here)
139
Upvotes
View all comments
Show parent comment
1
u/permetz Dec 03 '25
On the right, you need to reserve 11 digits on the right in the first round, 10 in the second, etc. On the left, you start with the last digit you found. So you're always searching for the first instance of the maximum digit in the range between the last maximum digit you found and 12 minus the round number from the end.