1

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.

  • @joriki Yes, you can loose one ball, you just need to find the matching hole, I wanted to clarify more in the heading but I ran out of chars, will now improve. So yes you can loose one ball... – Eugen Sunic Jul 06 '16 at 13:43
  • @joriki you are right you don't have to insert it just find the matching hole. Is this what you were asking for? – Eugen Sunic Jul 06 '16 at 13:46
  • Tnx for you patience and apologizing for the contradiction.. – Eugen Sunic Jul 06 '16 at 13:50
  • I've deleted my comments to reduce the clutter. You might want to also delete yours; and perhaps it wouldn't hurt to state explicitly somewhere in the question that you only have to identify the matching hole and don't have to insert a ball into it. – joriki Jul 06 '16 at 13:54
  • This problem is usually stated as dropping eggs out of a building and finding which floor is the lowest that will cause it to break. If you search "drop egg without breaking" there are references on quora and data genetics, among others. – Ross Millikan Jul 06 '16 at 14:01
  • Yep, the egss helped... tnx – Eugen Sunic Jul 06 '16 at 14:13

0 Answers0