Hello everyone, it’s time for your Advent of Code 2021 Day 9 log. Boy was today quite a busy day. Even though I completed the challenge to before 8 am, I still didn’t have any time to write this until tonight. Let’s make it nice and short like the challenge of the day.
This one reminded me of the Hackerrank exercises but not quite. Looking at the problem statement you get that you will have to do some sort of exploring of a grid. Yep, even before the second part appeared. Lucky for me, even though I mostly ignored that, I wrote the code for the first part quite cleanly. We had to loop through that grid and figure the “lowest points”, basically digits with no adjacent digit of inferior value. Pretty straightforward to code, don’t hesitate to check as the repo link is at the end of the post.
I wrote this thing clean enough to rely upon once part two reared its pretty face. I say pretty face because unlike day 7 this was no catfish. My beautiful bit of code fit perfectly in that one. No ugly brute-force this time, only finesse.
As a matter of fact, the second part was as easy as the first. Well, so long as you’ve written a few bits of code exploring grids. Otherwise, you will be in a bit of a pickle. Despite running into the usual challenges of mistyping a test value and the likes this went quite smoothly. Hopefully, tomorrow will be a little more challenging but not too much as I like my sleep.