Closed midorishibukawa closed 10 months ago
this one was much harder in thought than in practice, as I spent a long time thinking about it and not actually writing any code (to be honest, I was also pretty distracted with setting up github actions workflows for this project. I also swapped from jane street's core library to ocaml batteries included during the process, which I've been enjoying a lot.
as the input for this one couldn't really be parsed in the same way as I did for the previous challenges, I decided to first split the string on newlines, and then parse it as a list of lists of chars. this way, it's much easier to look all around a digit to check if it's adjacent to any symbols.
the logic goes as follows:
is_valid
argument to trueis_valid
flag is set to true
https://adventofcode.com/2023/day/3