Blog
read more
Advent of Code Day 2
So back to Advent of Code. And yay, Day 2 went swimmingly as well.
The first part looked hard, but then I realised that I’d made the usual “make it look harder than it is” mistake. You don’t need to compose the whole list, just keep track of how far you’ve got each time. This was pretty straightforward with some counting of offsets. Part 1 done.
I’ve often found that Part 2 of a day’s challenge is a tweak to Part 1. For Day 1,
I built a Counter object and then used it to identify the most common entry: