25
π - 2025 DAY 3 SOLUTIONS - π
(programming.dev)
An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!
Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.
Everybody Codes is another collection of programming puzzles with seasonal events.
Solution Threads
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 |
Icon base by Lorc under CC BY 3.0 with modifications to add a gradient
console.log('Hello World')
My original solution for part 1 was just removing the last digit, get the highest number, cut off everything up to and including that first number, get the highest number again.
Once I did part 2 I realized I can just throw in a loop, cut off parts of the end so there's enough numbers left for the subsequent iterations and keep the rest the same.
Now it works for any number of batteries and all you'd need to change is the number after
Total!:DOnline pad: AoC-2025-D3
You can even use your own input by uploading a file (make sure it's using LF line endings only with a trailing one at the end) and replacing the example input with this:
&rs inf &fo "input-file.txt"Code