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
11
u/Just-Routine-5505 Dec 03 '25
Because once you pick a digit, everything before it is no longer usable. So the left edge jumps to right after the digit you just chose. That’s why it sometimes moves forward suddenly instead of sliding smoothly.