prototypes identical prototypes and a building with floors numbered 1 to floors.
There is a threshold f (0 ≤ f ≤ floors): a prototype dropped from any floor above f breaks, while one dropped from floor f or lower stays intact. You don't know f in advance.
In one drop you release an intact prototype from any floor between 1 and floors. A broken prototype is gone for good; one that survives can be dropped again.
Return the smallest number of drops that is guaranteed to pin down f exactly, whatever its value.prototypes=1, floors=3 → 3
With one prototype there is no room for risk: drop it from floors 1, 2 and 3 in turn. The worst case needs 3 drops.
prototypes=2, floors=10 → 4
Drop first from floor 4. If it breaks, the second prototype checks floors 1–3 one by one. If not, drop next from floor 7, then 9. Every outcome is settled within 4 drops.
prototypes=3, floors=1 → 1
prototypes=1, floors=3
3
Run checks the first 3 tests in your browser. Submit checks all 95 tests on the server, hidden ones included.