30
🧸 - 2026 DAY 1 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')
C++
I'd have to check back through them, but they tend to be pretty easy on the first day; let the people that are using Excel get a win. 12 days again this year, so they should ramp up pretty quick - I actually preferred that last year, keep it short and sweet, no filler.
Solved by counting the entries in a hash map, then sorting it. 90 microseconds.
Is there any benefit of using the boost map instead of a standard std one?
It's about fifty times faster, since it doesn't make the specification-required mistakes in the standard one. (Specifically, iteration in constant time. The Boost one is 'always faster', but not constant. Constant time requires maintaining a separate linked list of all entries, which wastes time and memory.)
For this; no, makes no difference. The problem space is so small that the standard maps are quite fast enough. Just force it habit to never use them.
Ah ok interesting, thanks. My C++ lecture hasn't touched on external? libraries yet.