Sponsored Ad

Thursday, January 13, 2011

Rat and Poison Bottle Interview Puzzle

Rat and poison bottle puzzle:

Rat and Poison Bottle Interview Puzzle

Puzzle: There 8 bottles and one of them have poison. How may minimum rats you want to find out in which bottol have poison. Condition is that you need to feed all rats at same time and only once?

Answer: You need to mix the bottles in different combinations and then find out on the basis of which rat is dead.

(2) power 3 = 8 so you need minimum 3 rats to find the poisonous bottle.

lets have 3 rats A, B , C and you have to mix 8 bottles in such way that you get unique mixture.

we have bottles b1, b2, b3, b4, b5, b6, b7, b8

lets mix and make 3 mixtures:

lets represent every bottle in binary:
b1: 001
b2: 010
b3: 011
b4: 100
b5: 101
b6: 110
b7: 111
b8: leave it.

mix 1: which contains 1 at right most - b1,b3, b5, b7
mix 2: middle onc - b2, b3, b6, b7
mix 3: leftmost one: b4, b5, b6, b7

now give mix 1 to rat A
mix 2 to rat B
and mix 3 to rat C

if all three rats die it means b7 is common in all three mixture so b7 have poison
if non will die it means b8 have poison
if rat A only die it means b1 have poison
if rat A, B die it means b3 have poison etc

No comments:

Post a Comment

Sponsored Ad


Follow Us