Interview Brain Teasers
Hard
3 min
You have a building with 100 floors and two identical glass balls. You need to determine the highest floor from which a ball can be dropped without breaking, while minimizing the worst-case number of drops. What is the classic strategy based on?
Hint
Use decreasing jump sizes.
Answer
Triangular-number strategy.
Explanation
With two balls, the classic strategy uses decreasing intervals. The first ball is dropped at floors separated by 14, then 13, then 12, and so on, because 14+13+...+1 = 105, enough to cover 100 floors.
Step-by-Step Solution
Choose the first drop at floor 14.
Then increase by 13, then 12, then 11, etc.
The total coverage is 14+13+...+1=105.
This minimizes the worst-case number of drops to 14 for 100 floors.
Then increase by 13, then 12, then 11, etc.
The total coverage is 14+13+...+1=105.
This minimizes the worst-case number of drops to 14 for 100 floors.