2025-advent-of-code

following along with the advent of code 2025 (Matlab)

View on GitHub

Day 01

This problem relates to positions of a dial and left/right rotations.

Tips

-textread works well, but results in a cell array of strings. You can replace part of a string with another (e.g. think about what ‘R’ could become)

Second problem

Rather than keeping track of all end points after the rotations, you need to keep track of all the positions visited on the way.

%% idea for part 2 is:
% keep track of all the dial position visited, so
% R50 = +50 becomes a segment 0 + 1:50... careful to keep MOD!
% so +5000 would be 0 + mod(1:5000, 100)

illustration that might help

Matlab solution (no peeking!)

Matlab code / solution for the first part of that problem.

Second part solution of that problem.