The Wayback Machine - https://web.archive.org/web/20250822084354/https://www.geeksforgeeks.org/aptitude/puzzle-19-poison-and-rat/
Open In App

Puzzle | Poison and Rat

Last Updated : 06 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

There are 1000 wine bottles. One of the bottles contains poisoned wine. A rat dies after one hour of drinking the poisoned wine. How many rats are needed to figure out which bottle contains poison in an hour?

Puzzle- Poison and Rat


Check if you were right - full answer with solution below.

Solution:
To identify the poisoned bottle among 1000 within an hour, we use 10 rats and the binary number system. Since log⁡2 1000≈10, we need 10 bits to uniquely represent each bottle from 1 to 1000 in binary.

  • Steps 1: Number the bottles from 1 to 1000 and convert each number to its 10-bit binary equivalent.
  • Step 2: Assign each rat to a specific bit position (Rat 1 - bit 1, Rat 2 - bit 2, ..., Rat 10 - bit 10).
  • Step 3: If a bottle has a 1 in a certain bit position, the corresponding rat drinks from it.
  • Step 4: After one hour, the combination of rats that die reveals the binary number of the poisoned bottle.

Example:
If Rats 5, 7, and 9 die, the binary pattern is 0000101010, which equals 42 in decimal. So, Bottle 42 is the poisoned one.


Article Tags :

Similar Reads