23
๐ฌ - 2026 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')
Hare
Not too complicated but my solution is clearly inefficient. For part 1 I built a horizontal segments for each pair of trees on each line and when the length of a segment fit in the height of the currently read map, I check if the same segment exists $length rows higher.
part 1
For part 2 I created a real list of points, wrote functions to do all the math around points and defining squares. I build a list of all the known squares and finally compute its length. At some point it didn't work because I only checked the length of the sides of my squares, not the diagonals, so I had too many squares but couldn't tell what was wrong. I doubted the sort algorithm so hard I rewrote a bubble sort, to be sure lmao
part 2