WorldQuant Interview Question: You are given 2 eggs. * You h... | Glassdoor.co.in

Interview Question

Research Analyst Interview Bengaluru

You are given 2 eggs. * You have access to a 100-storey

  building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical. * You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking. * Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process
Answer

Interview Answer

7 Answers

2

floor(n/2) + 2

un on 21-Apr-2011

This post has been removed.
Please see our Community Guidelines or Terms of Service for more information.

0

floor(n/2) + 1

Pattara on 11-Sep-2011
21

first egg, try floors at 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100
second egg then try floors in between,
then no more than 14 tries total in worst case

wxt on 28-Sep-2011
1

for n floor building answer will be
Int refers to rounding of the closest integer.

Int(sqrt(n))) - 1*Z + (IntSqrt(n) - 1) + (n - M)

where Z = 0 if n - Int(sqrt(n))^2 > 0
             Z = 1 if n - Int(sqrt(n))^2 <= 0

and M is maximum integer multiple of Int(sqrt(n) <= n

Anonymous on 20-Jun-2012
0

50 times: 2,4,6,...,100

John von Neumann Institute on 03-Apr-2013
0

earlier answer 14 drops is wrong because if the floor at which egg breaks is 68, it will require 15 drops: 14 27 39 40 50 60 69 61 62 63 64 65 66 67 68

Therefore the minimum drops is 15:
drop first egg in these floors. no chance you will need to drop more that 15 times.
15 29 42 54 55 65 74 82 89 95 100

Allmin Pradhap Singh on 05-Jan-2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.