The idea for part one is to first determine the maximum field, based on the min/max values of the x and y coordinates. Then, for each position in the field, determine the distance to each of the input coordinates, keeping track of the coordinate that is the closest to the position in the field. Once this information is calculated, we can determine the size of the largest area within the field.
Part two largely follows the same logic, but takes the sum of a position in the field to all input coordinates, instead of taking only the closest one.
Here we go, this is my solution in Elixir.
The idea for part one is to first determine the maximum field, based on the min/max values of the x and y coordinates. Then, for each position in the field, determine the distance to each of the input coordinates, keeping track of the coordinate that is the closest to the position in the field. Once this information is calculated, we can determine the size of the largest area within the field.
Part two largely follows the same logic, but takes the sum of a position in the field to all input coordinates, instead of taking only the closest one.
Common:
Part one:
Part two: