Logic Question
Apparently this question was asked in a job interview for Google. Try your computation power and see if you could get a job at Google.
There are 100 floors in a building. You have two eggs. If the eggs will only break once it is thrown from a height beyond a particular floor. In what pattern would you throw the eggs off the building in order to locate that particular floor with the least amount of throws.Highlight the text below to see the answer:
For example, if you throw an egg beginning from the first floor until you reach the particular floor, it would take you 99 times if the particular floor the eggs would break is 99th floor. Which obviously, is not the most efficient pattern of experiment.
Divide building into ten intervals. Throw an egg on each interval beginning from the ground floor until it breaks. Then start throwing the remaining egg from the immediate lower interval, floor by floor, in ascending order. When the egg breaks, you've got the particular floor.
For instance, if the particular floor is 78, you'd throw an egg at 10, 20, 30, 40, 50, 60, 70, 80, 71, 72, 73, 74, 75 ,76, 77, 78th floor in order, where bold are the floors in which the eggs would break. So it would take you at most, 18 throws to locate that particular floor (no matter where within the 100th floor it is located), assuming that the egg must break on one of the 100th floors.
Thanks to Joe for bring my attention to this question.




My Public Profile
Hong Kong Regional Weather


1 comments:
Hi, it's a very great blog.
I could tell how much efforts you've taken on it.
Keep doing!
Post a Comment