Sherlock and MiniMax Discussions | Algorithms | HackerRank
We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This challenge has one of the worst explanation and name i have seen.
Here is my take on how to imagine it:
Meet Fred.
Fred doesn't like to live next to cities.
But Fred lives in a world where there is only one dimension and expensive gas.
Fred has a one dimensional map, where each city is market on a coordinate axis. Like { 0, 6, 7 , 13 }. Distance to any city is simply the absolute difference of the coordinates.
Now Fred wants to move away as far as he can from any city for as little cash as he has.
Fred currently lives at P and has only enough money to drive to Q.
Also, Fred won't drive backwards as he has a bad history with the towns to the left.
Where should Fred stop while being most cost effective?
(Linear search gave me max(0.02s) in python, this problem should be ranked more easy)
Sherlock and MiniMax
You are viewing a single comment's thread. Return to all comments →
This challenge has one of the worst explanation and name i have seen. Here is my take on how to imagine it:
Meet Fred.
Fred doesn't like to live next to cities.
But Fred lives in a world where there is only one dimension and expensive gas.
Fred has a one dimensional map, where each city is market on a coordinate axis. Like { 0, 6, 7 , 13 }. Distance to any city is simply the absolute difference of the coordinates.
Now Fred wants to move away as far as he can from any city for as little cash as he has.
Fred currently lives at P and has only enough money to drive to Q.
Also, Fred won't drive backwards as he has a bad history with the towns to the left.
Where should Fred stop while being most cost effective?
(Linear search gave me max(0.02s) in python, this problem should be ranked more easy)