Expand description
§Garden Groups
Solves both parts simultaneously by flood filling each region.
For part one we increment the perimeter for each neighboring plot belonging to a different region or out of bounds.
For part two we count each plot on the edge as either 0, 1 or 2 sides then divide by 2. An edge plot contributes nothing if it has 2 edge neighbors facing the same way, one if it has a single neighbor and two if it has no neighbors.
For example, considering the right edge:
... ... .#. > 1
.#. > 2 .#. > 1 .#. > 0
... .#. > 1 .#. > 1Functions§
Type Aliases§
- Input 🔒