View Single Post
Old 10-13-2009, 04:55 PM   #74
MrRubix
FFR Player
FFR Veteran
 
MrRubix's Avatar
 
Join Date: Dec 1969
Location: New York City, New York
Posts: 8,340
Default Re: Solve this equation for me

leonid: Alright, harder problem for you (I've always loved this problem -- was given to me in an interview).


You have a building with 100 floors, and you've got two glass spheres. These spheres are identical and breakable when dropped from a certain floor. For instance, if these spheres begin to break when dropped from floor X, that means they will also break any any floor above X and not break at any floor below X.

Once a sphere breaks, you lose that sphere. Develop an algorithm where you can guarantee me a maximum number of drops needed to find which floor is where the spheres' breakpoints are (it's possible that they'll survive even from floor 100).

Example: Worst algorithm: Start at floor 1, drop. If it doesn't break, drop from floor 2, etc... if the breakable floor was X=100, then that means you needed 100 drops.
MrRubix is offline   Reply With Quote