Tagged

  about.tagged.com
  about.tagged.com
Work in HR? Unlock Free Profile

Interview Question

Analytics/Reporting Interview San Francisco, CA

Given a 100 story building and 2 eggs which you know will

  break at the same floor every time when dropped, find the exact floor where the eggs will break.
Answer

Interview Answer

2 Answers

0

Recursion algorithm: start at first even floor, drop egg. If no break, move up to next even floor. If break, move down one floor and test. If 2nd egg breaks on odd floor, that is the floor where eggs break. If 2nd egg doesn't break on odd floor, then the +1 even floor is the correct floor.

Was told a b-tree or similar solution was not actually correct by the interviewer but it would have worked just as well to pick a starting point instead of starting from base level.

Interview Candidate on Jul 22, 2011
0

Why are we doing recursive analysis of what floor the egg is going to break on, when it's not going to do anything until it hits the ground or an unfortunate window washer or seagull?

Humpty Dumpty on Apr 20, 2013

Add Answers or Comments

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