Manhattan Meeting Place
Collapse Content
Show Content
You decided to add a new feature to your app. Given the locations of different people, the app will find the best place for them to meet so as to minimize the total travel time of all the parties.
Format
In each case, you will be given all the co-ordinates in a single Array:
{x1 y1 x2 y2... ...xn yn}
where each person n is located at position {xn, yn}. Calculate and print the best intersection to meet on a map.
Example
If given the following input:
0 2 2 7 7 5
...Print 2 5
which would be the location with the minimum total travel time.
Challenge
Print the co-ordinates of the meeting point that will minimize the total combined travel time.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Comments
https://www.learneroo.com/modules/49/nodes/293
Can anyone help me understand what I am doing wrong? I took the approach of saving the x and y values to their own arrays, and then iterating through
until I found the coordinates. I match up with the first set of Correct Output, but not the second or third.
Learneroo
Jun 7, 11:41 PMSee this post for an explanation of an optimal solution.
thales
Jul 20, 2:25 PMHoly Cr*** this was hard!
a solution:
my code
thales
Jul 20, 2:28 PMIs there a solution ( not explanation) that i can see. I got a solution but if this is a good one i really dont know. I want to know if there is a better way?