2025-advent-of-code

following along with the advent of code 2025 (Matlab)

View on GitHub

Day 06

Cephalopod maths…

Tips for first problem

  1. Pretty straightforward parsing problem. Read in the input file line by line, and split each line into tokens (numbers and operators). I used split after readdlm to get a matrix of strings.

  2. You can accrue sum with an if statement inside a loop. Keep track of the current operation (either + or *), and when you hit a blank line, add the current chunk to the total sum and reset the chunk. (I thought mapreduce might be useful, but it was more complicated than just a loop with an if statement.)

Second problem

Day 5 animated gif
!-->

Also, I over-wrote the original solution.jl file … so only code for Part 2 is available here. And it needs some refactoring and cleaning up!

Code

Julia solution

Julia code / solution for the first part of that problem (simpler version of the code ended up as solution for B!).

Second part solution of that problem.