Code Chronicle

Published: (December 21, 2025 at 12:51 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Part 1

A cool way to end the year. This seems like a fun challenge, and I’m excited to attempt it.

The first thing I notice is:

  • The example input separates locks and keys
  • My puzzle input does not

So my algorithm will need to be extra attentive when classifying them.

As per the explanation, I intend to store each lock and key as an array of numbers representing each column height. From there I can write an algorithm that does this:

For each lock
  For each column
    Further filter the list of keys to those with 5 - N height
    in this column, where N is the lock column's height
  Any remaining keys are winners

I’m excited to try coding it!

Writing my lock‑key matching algorithm

Processing the input into two lists that each contain 5‑digit lists:

input = input.split('\n\n').reduce((group, item) => {
    item = item.split('\n').map(line => line.split(''))
    if (item[0].every(el => el == '#')) {
        // Lock
        let digits = []
        for (let i = 0; i  el == '.')) {
        // Key
        let digits = []
        for (let i = 0; i  {
    tally += lock.reduce((keysRemaining, digit, index) => {
        return keysRemaining.filter(item => item[index]  el.slice())).length
})

Could it really be that simple?

Here’s what I’m doing:

  • Initialize a value to count all valid keys
  • Iterate through each lock
  • Increment the tally based on how long the final list of keys is after filtering it five times—once for each digit

When running it on the example input, I get 3, the correct answer. I’m tempted to just run it on my puzzle input. Worst case, I get a wrong submission and only have three more attempts to point me in the right direction. I’m going to do it!

Running on my puzzle input

What will it output? …

A number in the low thousands. Seems…right?

Time to submit…

It was correct!

Woohoo!!!

Year in review

I matched my lowest score in a year: 34.

Given that this year seemed like the hardest one, I’m very proud I didn’t set a new lowest score.

My 2024 advent calendar

As for all‑time scores:

Yearly scores list

382/500 is 76.4% or a strong C.

That’s been my average this entire journey thus far. This was another real‑fun year with interesting new puzzles. Up next, 2025!

Thanks again for reading.

Back to Blog

Related posts

Read more »

Advent of Code 2025 - Day 5: Cafeteria

!Me solving AoC Day 5https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazo...

Advent of Code 2025 - December 8th

In this series, I'll share my progress with the 2025 version of Advent of Code. Check the first post for a short intro to this series. You can also follow my pr...

Monkey Market

Part 1 Another math gauntlet I get to program a bunch of math operations. Some will be part of several conditionals. I've done it before. I'm confident I can d...