Advent of Code Python Solutions, Explained
michaelfogleman.com
michaelfogleman.com
I'm no Norvig, but I thought I'd try my hand at walking the reader through my own solutions this year. This is what I've come up with so far!
I'm currently 9th on the global leaderboard: https://adventofcode.com/2018/leaderboard
But I hope it remains clear to all that there's no singular right way to solve them. I remember writing a few of them thinking, "the big O is terrible but this is so much more obvious to read." Or even, "I bet part 2 will want to do X so I'll make it more robust for refactoring." So many variables. Fun to practice which ones you constrain.
Observable has made it fun to follow along and re-run the code.
There are much more interesting, highly optimized solutions and better discussion, animations, etc.
Looking at just Days 1 and 2, the author has given examples that are certainly concise, but (arguably) at the expense of readability. Similarly, the Day 2 part 2 answer is concise at the expense of performance, as there is a lot of duplicated comparisons and comparisons that could be skipped.
I was amused watching some people doing day 9 having solved it using a good datastructure and confused why p2 was so simple, vs watching people having no idea about their languages performance for the baked in collections they were using.
This thread might help you if you already pass all the tests : https://www.reddit.com/comments/a6f100/-/ebw1uda/