Advent of Code 2025 - Day 08

Okay, this one was tough.

Tried a dozen data structures before settling on circuit IDs + HashTable.

Accidentally mutated object fields while using them as hash table keys.

Still have no idea why the puzzle counts already-connected junction boxes, had to look it up on reddit.

Time to solve:

Part 1: almost 2 hours
Part 2: 4 minutes

Runtime: 364 ms.

Full solution at Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_08/solution.nim

#adventofcode #adventofnim #nim #nimlang

AoC 2025 - 07 bonus #2

I'm blind, because I don't know how I didn't see this 50 minutes ago, but here's even smaller version that runs even faster. 13% faster (95 µs -> 86 µs)

#adventofcode #adventofnim #nim #nimlang

AoC 2025 - 07 bonus

I've figured out a faster version of algorithm, that doesn't need a second array to add up splitted particles.

It results in a whopping 22% performance increase! (116 µs -> 95 µs)

#adventofcode #adventofnim #nim #nimlang

Advent of Code 2025 - Day 07

Another simple one today.

The trick here is to keep count of how many particles are in each column, instead of tracking each beam/particle. Even a simple 1d array is enough.

Runtime: 116 μs

Full solutions at Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_07/solution.nim

#adventofcode #adventofnim #nim #nimlang

Advent of Code 2025 - Day 06

I literally looked at part 2 for minutes trying to understand where the numbers come from and how they're related to the example input. I love #AdventOfReadingComprehension

The next roadblock was the trailing whitespace, that I hate and remove from all my code with Neovim plugin. Here removing it was creating subtle bugs and took me time to find out what was the problem.

Full solution at Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_06/solution.nim

#adventofcode #adventofnim #nim #nimlang

Advent of Code 2025 - Day 05

Today we got another easy puzzle. Very straightforward and almost too short.

Full solutions at Codeberg: https://codeberg.org/janAkali/aoc25-nim

#adventofcode #adventofnim #nim #nimlang #aoc #programming

Advent of Code 2025 - Day 04

Today was so easy, that I decided to solve it twice, just for fun. First is a 2D traversal (see image). And then I did a node graph solution in a few minutes (in repo below).

But it's a bit concerning, because every AoC fan knows that simple puzzle can only mean that tomorrow will be a nightmare 😬 . Good Luck Everyone, we will need it.

Full solutions at Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_04

#adventofcode #adventofnim #nim #nimlang #programming #aoc #puzzle

Advent of Code 2025 - Day 03

Day 3 was pretty straightforward, though I had a little trouble with the indexing.
I expected that part 2 would need dynamic programming, but I just ended up changing a few numbers in part 1, to solve part 2.

Final version runs in just 240 μs.

Full solution at Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_03/solution.nim

#adventofcode #adventofnim #aoc #nim #nimlang #programming

Advent of Code 2025 - Day 02

Easy one today. I've solved Part 1 fast and without problems. Part 2 is pretty forgiving on performance, so regex bruteforce was only a couple seconds in #Nim . But I eventually cleaned it up and did a solution that runs in ~340 ms.

Full solution is on Codeberg: https://codeberg.org/janAkali/aoc25-nim/src/branch/master/day_02/solution.nim

#adventofcode #adventofnim #aoc #programming #puzzle #nimlang

Advent of Code 2025 - Day 01

I've spent 40 minutes looking for off-by-one errors in part 2, gave up and rewrote the solution using bruteforce. Now I return to do it properly and turns out I didn't consider what happens when dial is zero.

Fuck zero. The worst number.

#adventofcode #adventofnim #nim #nimlang #fuckzero