Copyright | (c) Eric Mertens 2021 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2021/day/9
Find the basins on the height map.
>>>
:{
exampleGrid = Data.Array.Unboxed.listArray (C 0 0, C 4 9) [2,1,9,9,9,4,3,2,1,0, 3,9,8,7,8,9,4,9,2,1, 9,8,5,6,7,8,9,8,9,2, 8,7,6,7,8,9,6,7,8,9, 9,8,9,9,9,6,5,6,7,8] :}
>>>
exampleBasins = toBasinIds exampleGrid
>>>
basinRiskSum exampleGrid exampleBasins
15
>>>
basinSizes exampleBasins
[3,9,14,9]