My first solution was going to run out of memory, my second: is still running just in case.
Advent Of Code
An unofficial home for the advent of code community on programming.dev!
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.
AoC 2024
Solution Threads
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 18 | 20 | 21 | 22 |
23 | 24 | 25 |
Rules/Guidelines
- Follow the programming.dev instance rules
- Keep all content related to advent of code in some way
- If what youre posting relates to a day, put in brackets the year and then day number in front of the post title (e.g. [2024 Day 10])
- When an event is running, keep solutions in the solution megathread to avoid the community getting spammed with posts
Relevant Communities
Relevant Links
Credits
Icon base by Lorc under CC BY 3.0 with modifications to add a gradient
console.log('Hello World')
Same here: the "Out of Heap" error came as a bit of a surprise...
on my first attempt my computer couldn't run Spotify at the same time because it was paging so hard >.<
final go was in the order of 20 seconds or so I think (with practically 0 memory usage)
I thought it would be a long-runner, but I also guessed that getting to a better solution would take a while, so I set it off and it did eventually return an answer before I could even plan out a solution that might improve things. Who needs algorithms when you've got Moore's law.
My first version ran for about 90 minutes. My second version, for about 45 seconds. I'm sure there's more optimization to be done, but that was good enough for me :)
optimised in most of an evening, runs in 0.06 seconds - well at least it will be quick for all of the (one) times that I have to run it!
I coming a bit from behind, just did this question
part1 test answer is 35 (0.00 seconds)
part1 answer is 3374647 (0.10 seconds)
part2 test answer is 46 (0.00 seconds)
part2 answer is 6082852 (0.34 seconds)
interval arithmetics bitch