How to find the best way with the least amount of steps to find the matching hole (2 balls and 100 holes given)?

31 Views Asked by At

To extend the heading a little bit further. There are 100 holes ordered from min to max (min-hole with minimal radius, max-hole with maximum radius). There are two balls given which are to be used to find the perfect hole (matching hole). There is only one hole which matches perfectly with both balls (both balls are the same size as the matching hole which has to be found) . Find the shortest possible way to find the matching hole.

Note: if the ball in the whole is too big and the ball drops, you are loosing a ball.

What I've tried:

  • The easiest way is to insert a ball in the min-radius hole and then the second ball to the hole+1 until one ball goes away by falling inside the whole which means that the hole-1 is the matching hole if of-course the given ball does not match the most widest hole (max hole).
  • The second thing that I would apply is a form of binary search algorithm by reducing the wholes drastically but then I would need to measure the radius of the holes after dividing the set (and the ball radius), however I'm not sure if this is allowed.

I believe there is better attempt to solve the problem any suggestion are greatly appreciated.