Metro Land is a country located on a 2D Plane. They are having asummer festival for everyone
Question:
Metro Land is a country located on a 2D Plane. They are having asummer festival for everyone in the country and would like tominimize the overall cost of travel for their citizens. Costs oftravel are calculated as follows:
1) A city is located at coordinates(x,y)
2) The festival is located at coordinates(a,b)
3) cost of travel from a city to the festival = |x - a| + |y -b| per person
The festival can be held at any location in Metro-land. Find theoptimal location for the festival, defined as the location with theminimal total travel cost assuming all people attend. Determine thetotal cost of travel for all citizens to go to the festival at thatlocation.
Example: numsPeople:[1, 2], x = [1, 3], y = [1, 3]. The lowesttotal cost to travel is if the event is held at grid position(3 ,3) at cost of 4.
See this link has more details:https://codingee.com/metro-land-hacker-rank/
Fundamentals of Cost Accounting
ISBN: 978-0077398194
3rd Edition
Authors: William Lanen, Shannon Anderson, Michael Maher