Algorithm · Amazon · Hard
Implement minimum_inconvenience(grid). The argument grid is a binary grid with n rows and m columns: a cell holding 1 is a delivery center, and a cell holding 0 is an empty location. Distances between cells are measured with the Chebyshev metric, $$\max( r_1 - r_2 , c_1 - c_2 )$$. The inconvenience of the grid is defined as the largest value, taken over all empty cells, of the distance from that cell to its closest delivery center. If the grid has no empty cells, its…