Greetings, Erlang enthusiasts! Ukrainian Erlanger here!
Today, we’re diving into the art of fencing - literally. As the Elves struggle to calculate the fencing costs for the garden plots, we’re here to lend a hand with the power of Erlang!
The task: Determine the total price of fencing all regions on the garden map. Each region is defined by connected plots of the same type, and the price is calculated as the product of its area and perimeter.
Tips for solving Day 12:
- Flood-fill or DFS/BFS is great for identifying connected regions of the same type.
- For each region, calculate its area by counting the number of plots and its perimeter by checking exposed edges.
- Efficiently parse the map into a grid or coordinate system for easier traversal.
Challenge Motivation:
From connected plots to calculated costs, let’s fence it all and BEAM together!
Share your approaches, solutions, or any challenges you’re facing. Whether you’re building fences or debugging edge cases, this is the place to collaborate and learn.
Happy coding, and may your fences always be well-calculated!