Code Chronicle
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.

As for all‑time scores:

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.