13
๐ฝ - 2026 DAY 2 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')
Kotlin
I don't know if I've ever seen an easier part 2 than today. If anything, I assume part 2 makes it possible to use the grouping counts from yesterday and do some smart maths with that, but I'm too sleepy to come up with that right now.
Code is just mapping the chars to ints for easier math (although now that I think about, I could've also just kept them as chars) and then counting the difference between chars following each other.
Edit: I've improved my
walk()method to be more Kotlin-like, but it does still "step" along the input:Solution
full code on Codeberg