Interview Question

Software Developer Interview(Student Candidate)

Brain teaser question: You have two glass balls and you

  wanna test how strong they are by dropping them from a 100-story building. What's the algorithm that requires minimum number of trails.
Tags:
brain teaser
Answer

Interview Answer

2 Answers

0

Start at sqrt(number-of-floors), or 10 in this case. Increase by that same number until one breaks. Go back down by that number and go up by 1 for the remaining tests.

Michael on Mar 1, 2013
0

go to 19th floor if the egg breaks go from 1-18 else 38 like that

mani deepak on Aug 24, 2013

Add Answers or Comments

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