Shortest distance out of convex area

Правка en2, от suraniap, 2023-09-14 03:49:26

Find shortest distance out of a convex area.

We have our initial starting coordinates sx, sy. We're given an API that we can call which for x and y floats returns a bool which represents if the specific point is inside the area. (def uber_has_surge(x:float, y:float) -> bool)

Find the shortest distance out of the surge pricing area in a minimum number of API calls. (assume interactive)

I thought about trying to call with 4 directions and have a circle which represents max distance that might be the answer. The problem is that this is still brute force.

Another idea would be to find a boundary point, and then do binary search on polar coordinates, but I don't understand exactly how that might work?

Теги geometry, math, binary-search

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский suraniap 2023-09-14 03:49:26 20 Tiny change: ' calls**. \n\nI thou' -> ' calls**. (assume interactive)\n\nI thou'
en1 Английский suraniap 2023-09-14 02:15:01 746 Initial revision (published)