Published December 02, 2025
I've decided that this year, in addition to publishing my solutions on GitHub, I'll do a blog post explaining the solutions I came up with and how I got there.
The first AOC challenge this year was to find the combination to a lock. We
were given input that was turns of a dial with the numbers 0 - 99. The input is a list of turns in the format of an
L or an R followed by how many clicks on the dial to turn it. So L34 would mean to turn it 34 times to the left and
R17 would be 17 times to the right. The dial itself is set to 50 at the start.
In part 1 we need to figure out how many times the dial ends up on 0 after the turn. For this we take the current position of
the dial and add (for R) or subtract (for L) the number of clicks. If that's a 0 we increment the counter. We can use the
modulo operation (%) to determine if that's a 0:
if (dial + clicks) % 100 == 0:
total += 1
Since we only care about the numbers 0 - 99 the % will strip out anything else.
>>> 512 % 100
12
>>> -512 % 100
88
Once we do that with the entire input set, we have our solution.
Part 2, as always, is a bit trickier. We need to count how often the dial passes 0. This means we actually have to run through
the clicks and determine how often a given turn will have it hit 0. There are 2 shortcuts we can take:
0 for any turns that are longer than 100:
zeroes = turn // 100
0 since, by definition, we won't be going around again.This brings us something reasonably efficient. I did try noodling around to see if it was possible to not go through every single click but I was unable to find a way that worked - if you have one, reach out to me on Mastodon and let me know.
To see my full solution, you can head over to https://github.com/brass75/AdventOfCode/blob/main/aoc_2025/day1.py.