Question: Amazon has recently established n distribution centers in a new location. They want to set up 2 warehouses to serve these distribution centers. Note that
Amazon has recently established n distribution centers in a new location. They want to set up warehouses to serve these distribution centers.
Note that the centers and warehouses are all built along a straight line. A distribution center has its demands met by the warehouse that is closest to it A logistics team wants to choose the location of the warehouses such that the sum of the distances of the distribution centers to their closest warehouses is minimized.
Given an array dist centers, that represent the positions of the distribution centers, return the minimum sum of distances to their closest warehouses if the warehouses are positioned optimally
write the python code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
