This question evaluates facility-location and spatial optimization skills under the Manhattan (L1) metric, testing algorithm design, combinatorial optimization, and handling geometric data.
You are given the coordinates of N people on a 2D grid. You want to open K shuttle pickup locations (pickup points) so that the sum of Manhattan (L1) distances from each person to their nearest pickup location is minimized.
N
(number of people).
points
of length
N
, where
points[i] = (xi, yi)
are integer coordinates.
K
(number of pickup locations).
where are the chosen pickup locations.
Provide an algorithm appropriate for interview constraints (e.g., N up to a few thousand, K up to N).