Microsoft
3.6 of 5
www.microsoft.com Redmond, WA 5000+ Employees

# MicrosoftSoftware Developer Interview Question

"If you had 100 floors and 2 eggs, what is the most efficient way to determine what floor is the maximum height you can drop an egg and not crack it?"
Add Tags [?]
Answer Flag Question

Part of a Software Developer Interview Review - one of 2,762 Microsoft Interview Reviews

Answers & Comments

0
of 1
vote
go up N floors at a time til you lose the first egg. Average half of 100/N tries. Then go 1 by 1 until you crack the second. That's N/2 on the average. So to minimize the total N/2+50/N take the derivative set it equal to zero, and solve for N. Looks like 1/2-50/N^2=0 so N=10 and check for fenceposts.
I would turn down this job if they insult my intelligence with a question this simple.
- bobthenerd on May 24, 2012 Flag Response
0
of 1
vote
100th floor is heighest and it will not crack the floor
- selvakumar on Jun 10, 2012 Flag Response
0
of 2
votes
binary search problem. go to n/2 or in this case 50th floor. drop first egg if it breaks go to the middle of the 50th floors eg 25th and if it doesnt break go to the middle between the 50th and 100th e.g. 75th. It would take on avg log n tries. fairly simple.
- alan on Jul 18, 2012 Flag Response
0
of 0
votes
what if the egg is broken on 5th floor then binary search is not effitient .
sequencial search is possible from the 1st floor to 100th floor if egg is broken on nth floor then n-1th floor is the maximum height you can drop an egg and not crack it.
- mukkiee on Aug 11, 2012 Flag Response
1
of 1
vote
it could be solved with only one egg. go to first floor, drop the egg, if it doesn't break, repeat the same for the second floor and so on, until it breaks, then its the floor just before it breaks
- moataz on Oct 4, 2012 Flag Response
0
of 0
votes
I was asked this question in an interview, and it was horrible because the interviewer didn't really understand what he was asking. It's a tough question to grasp.

I think the best explanation I have seen of this puzzle is right here:

http://www.programmerinterview.com/index.php/puzzles/2-eggs-100-floors-puzzle/

Everything else just does not cover the details properly.
- Joe on Oct 9, 2012 Flag Response

To comment on this question, Sign In with Facebook or Sign Up

### Microsoft – Why Work for Us?

What do you want in a job? Do you want more than a paycheck? At Microsoft, you can discover potential you didn’t know you had, push your limits, turn your ideas into reality and make a real impact on the industry and…

Provided by employer [?]

### Salaries by Company

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Microsoft interview questions and advice. All interview reviews posted anonymously by Microsoft employees and interview candidates.