10 Mice, 1000 Bottles, and the Binary Trick That Exposes CRUD-Only Backend Engineers
The question is a fast proxy for whether a backend candidate internalizes bitwise reasoning and space-time tradeoffs. Engineers who can't map a set of binary states onto a lookup problem will struggle with bitmaps, Bloom filters, and the kind of compact data structures that keep high-scale systems from falling over.
The classic puzzle — one poisoned bottle hidden among 1,000, with mice that die exactly one hour after drinking — has a precise answer: 10 mice. Each bottle gets a 10-bit binary label. A mouse drinks from a pool containing a drop of every bottle whose nth bit is 1. After the poison takes effect, the pattern of dead mice reads out as the binary index of the poisoned bottle. 2^10 = 1024 states, which covers all 1,000 bottles with room to spare.
ByteDance and other large Chinese tech firms use this question to filter for engineers who understand information density, not just procedural logic. The setup mirrors a bitmap or Bloom filter: a tiny bit array encodes membership across a large set. Ten bits resolve 1,000 possibilities in one parallel round, trading a small amount of space for zero additional time.
The trap answer is 20 or some linear-search count. The right answer signals that the candidate thinks in state-space compression and bitwise operations — the same instincts that separate engineers who build high-throughput systems from those who only write CRUD wrappers.
The question functions as a quick classifier: a candidate who defaults to linear search reveals they don't reach for binary encoding as a first instinct, which is a red flag for roles that involve high-throughput data structures.
Many experienced backend engineers who live in high-level frameworks lose fluency with bitwise operations; this puzzle exposes that gap in minutes.
The setup is isomorphic to a Bloom filter with no false positives — each bottle maps to a unique bit pattern, so the 'filter' is actually a perfect hash.
The core dispute is whether the binary-encoding solution is over-engineered. A loud faction insists one mouse drinking sequentially solves the problem with zero casualties beyond the unlucky tester, dismissing the 10-mouse method as academic navel-gazing. The counterpoint, implied in replies, is that the one-mouse approach ignores implicit constraints like time or a limited number of test rounds, without which the puzzle collapses into triviality. A secondary thread questions the physical assumptions: whether a sip constitutes a lethal dose and whether alcohol poisoning from multiple non-toxic samples would confound the result.
Don't get it. One mouse is clearly enough. Just have one mouse keep testing the poison. It'll die when it drinks the poisoned one. There's only one poisoned bottle, so once it hits it, you've eliminated it. Kind of like asking a PhD student whether rain falling from 10,000 meters would kill someone? A bunch of PhDs doing all sorts of calculations, but they're no match for a cleaning lady asking: 'Haven't you ever been caught in the rain?'
Don't ask me if the efficiency would be super low, because I feel sorry for the mouse [innocent dumbfounded]
Haha, this kind of problem should also have time and attempt limits, otherwise the question is meaningless.
Without any other constraints, I think one mouse is enough. Just let this mouse drink. If it doesn't die, switch to the next bottle. If it dies, you've found the poisoned wine. [grin]
hahahahahahahahahahahahahahahahahahahahahaha
2^10=1024. Isn't the algorithm just a simple binary search? Why make it so convoluted?