The 1000 Bottles of Wine
The Puzzle: A king has 1000 bottles of wine. One is poisoned. A single drop of this poison will kill a rat after exactly 24 hours. You have 10 rats and only 24 hours to find the poisoned bottle. How do you do it?
1. The Power of 2
2{10}=1024. This means 10 bits can represent any number from 0 to 1023.
2. The Solution: Binary Mapping
- Label each bottle from 1 to 1000 in binary form (e.g., Bottle #1 is
0000000001, Bottle #1000 is1111101000). - Assign each rat to a specific “bit position” (Rat 1 is bit 1, Rat 2 is bit 2, etc.).
- Feed the rats: Rat i drinks a drop from every bottle that has a ‘1’ in its i-th bit.
- Wait 24 hours.
3. The Result
If Rat 1 and Rat 3 die, but all others live, the binary code of the poisoned bottle is 0000000101 (which is Bottle #5).
The set of dead rats gives you the exact binary address of the poisoned bottle.
Interview-Focused Questions
Q: Why don’t we use 1000 rats (one for each bottle)?
A: Because that is inefficient. The question is “How few rats can you use?”. By using binary representation, each rat’s life becomes a bit (Dead=1, Alive=0), allowing 10 rats to represent 2{10} different states.
Q: What if you had 48 hours instead?
A: If you have more time, you can use fewer rats by using a Ternary (Base-3) or higher system. With two rounds of 24 hours, each rat can have 3 states (Die in round 1, Die in round 2, Live). 7 rats would be enough (37=2187).
Key Takeaway
This is a classic “Information Theory” problem. It tests if you can think of individuals (rats) as data storage units (bits).
Premium Content
Unlock 1000 Bottles of Wine and all premium lessons with a subscription.
From ₹199.99/year — See plans