1 min read

Advent of Code 2020 Day 7

Advent of Code 2020 Day 7

So, this morning, when Sudo woke me up at 1:30 AM and I decided to use the toilet, I checked twitter quick and saw the following:

Once I saw that, I figured I'd take a look at the day 7 problem to find out it wasn't completely necessary to do recursion (and for sure recursion is hard to debug) but recursion did make the code a bit simpler. At that point, I calmly went back to bed (and let Sudo kick me multiple times) and dealt with it in the morning when I really got up.

Once I got up and let Sudo do his morning business I got to my computer and started reading the actual problem.  I really didn't run into any real roadblocks other than taking time to put together classes to store the respective pieces.  Part one traversed a tree of data to count the number of parents that could get to the child. Part two traversed the tree to the bottom to count the number of bags actually included given a single bag (each bag may contain a set number of other bags). The only strange part there was where to set and include 1 for the encompassing bag to then roll back up to the next level.

Also, the video referenced in the tweet above led to a series on TED-Ed and if you have any interest in learning programming or logic behind programming (or problem solving in general) it really seems to be a great series, here's a link to the full playlist and the first video is embedded below.

Think like a coder Episode 1 (from TED-Ed)

If you want to join my Advent of Code leaderboard, feel free to join with the code: 699615-aae0e8af. I'll keep pushing to complete these challenges, because I find them to be fun and interesting.