Easy | Strategy |

An Egg breaks only if dropped from above a threshold floor, within this 100 story building. Every time you drop the egg, it is counted an attempt. You are given two eggs, find an algorithm to deduce the threshold floor, with minimum number of attempts in worst case!

Hint

If we had only 1 egg, we would go linearly from 1 to 100. Having an extra egg gives an opportunity to jump (skip some floors from testing). When 1st egg breaks, second egg moves linearly. Think why first egg should not move in constant jumps, but rather decreasing jumps! This will give 14 steps in the worst case.

Answer

It can be done in 14 steps in the worst case.

Solution

A solution for minimum steps in worst case is the smallest integer greater than or equal to the positive solution of n(n+1)/2=100...which gives 14....

start at 14th floor, if egg breaks start linearly from 1, if it does not break drop the egg from 14+13 = 27th floor, and so on....

My friend was asked only one puzzle in his interview, "3 eggs". He got the job.

start at 14th floor, if egg breaks start linearly from 1, if it does not break drop the egg from 14+13 = 27th floor, and so on....

My friend was asked only one puzzle in his interview, "3 eggs". He got the job.

Source: Quant Interview

Enable Like and Comment Latest solved Puzzles

Color Switches Weird Sequences Intersecting Pillars Consecutive sums Scaling a Square Difficulty Level

© BRAINSTELLAR |