aoc-2021-rust

Advent of Code 2021 Solutions in Rust
git clone https://git.sinitax.com/sinitax/aoc-2021-rust
Log | Files | Refs | README | sfeed.txt

part2 (1281B)


      1--- Part Two ---
      2
      3Next, you need to find the largest basins so you know what areas are most important to avoid.
      4
      5A basin is all locations that eventually flow downward to a single low point. Therefore, every low
      6point has a basin, although some basins are very small. Locations of height 9 do not count as being
      7in any basin, and all other locations will always be part of exactly one basin.
      8
      9The size of a basin is the number of locations within the basin, including the low point. The
     10example above has four basins.
     11
     12The top-left basin, size 3:
     13
     142199943210
     153987894921
     169856789892
     178767896789
     189899965678
     19
     20The top-right basin, size 9:
     21
     222199943210
     233987894921
     249856789892
     258767896789
     269899965678
     27
     28The middle basin, size 14:
     29
     302199943210
     313987894921
     329856789892
     338767896789
     349899965678
     35
     36The bottom-right basin, size 9:
     37
     382199943210
     393987894921
     409856789892
     418767896789
     429899965678
     43
     44Find the three largest basins and multiply their sizes together. In the above example, this is 9 *
     4514 * 9 = 1134.
     46
     47What do you get if you multiply together the sizes of the three largest basins?
     48
     49