Egg Question:
A building has 100 floors. One of the floors is the highest floor an egg can be dropped from without breaking.
You have 2 eggs. Find the least amount of drops.
My thought process:
The o(n) solution just iterating through
How to cut it down:
Go to the 50th one... but then worst case would be 49th. Surely better?
What about cutting it up in 10s.. 99th would be 19 drops.
Solution:
We need to decrease the number by 1 each time. So it is a triangulation problem.
We drop from the 14th floor since the quadratic of n^2 + n -200 = 0 solves to 13.651 so we round up.
This gives the worst case of 14 drops for the last floor or cool
Top comments (0)