Python Solution for 2021 Advent of Code - Day 9 Part 1 - Smoke Basin

preview_player
Показать описание
Solution to Part 1 of 2021's Advent of Code's Day 9's problem. You might have different data to deal with. However, hopefully the code still works the same for you as it does for me.

Bradley Sward is currently an Associate Professor at the College of DuPage in suburban Chicago, Illinois. He has earned a Masters degree in Software Engineering from DePaul University, a Masters degree in Computer Science from the University of Illinois at Springfield, and two Bachelors degrees in Computer Science and Molecular Biology from Benedictine University. Prior to teaching, Bradley worked for five years in the field of casino gaming on a variety of video slot machine and poker games. The Village People have been permanently etched into his brain.
Рекомендации по теме
Комментарии
Автор

To keep track of the map I used a hashtabel ( The `dict()` datastructure in python) and looked for all 9 values in the map. Why look for 9? Because it is the maximum! And from there i used the `set()` data structure in python to add all values strictly lower than the point I'm looking at, unless it is the lowest. Starting at all points with value 9.

All in all; `dict()` and `set()` have been quite helpfull for this years advent of code to handle large amount of data, and sorting it.

matshoemolsen