Add day 1

A little bit of a rough start... part 1 was very easy and I did it with
a simple for loop (is_digit and to_digit). Unfortunately part 2 required
a major rework, so the code here is basically just a full rewrite.
Sorry.

Being honest I was a bit surprised: I normally expect days 1-5 to be
quite a slow start, but here we are on part 2 and I've already been
thrown a curveball.

My solution here works with a regular expression and a hashmap, I had a
bit of trouble because I initially tried to use an enum to represent my
values (being either a number or a string) before realizing first that
it wasn't hashable and second that it was overcomplicated. This one just
uses strings. Much better.

I'm sure there are more elegant ways (for example I've seen a neat
algorithm with a rolling window to match digit groups), but throwing a
regex at the problem was quick.

Change-Id: I1ac283d75d6571b08b5d9439f181e9dd7f308ec0
Reviewed-on: https://git.clicks.codes/c/Minion/AdventOfCode/2023/+/91
5 files changed
tree: 0dd08ae48116ca617023a12e1a982c118b42744e
  1. day1/
  2. .gitignore
  3. .gitreview