2025-advent-of-code

following along with the advent of code 2025 (Matlab)

View on GitHub

Example - Day 01 (2024)

The Problem description explains the task.

You need to think about sorting lists, taking differences, and summing.

Write down a plan before coding - like a kind of an essay plan - what are the steps you need to take to solve the problem? You can use % to write comments in matlab code

%% this is a comment (for humans, ignored by matlab)
%  two % signs make it a "snippet" that can be run 
%  separately in matlab.

%% 1. somehow read the data in

%% 2. sort the data (columns?) 
Matlab solution (no peeking!)

Matlab code / solution for the first part of that problem. distanceFinder = @(A) sum(abs(diff(sort(A),[],2)));


Walkthrough on Youtube

Here is a step-by-step video of how to solve problem. No sound at the start… but some commentary on the one-liner solution at the end.

Walkthrough video

https://youtu.be/FlyLguwogO0