Math, asked by BrainlyProgrammer, 19 days ago

New Question!!!

Q) There is a building of 100 floors If an egg drops from the Nth floor or above it will break. If it’s dropped from any floor below, it will not break. You’re given 2 eggs. Find N, while minimizing the number of drops for the worst case.
_
#Quality_Answers ;)​

Answers

Answered by shagun7b1234
2

Let us make our first attempt on x'th floor.

If it breaks, we try remaining (x-1) floors one by one.

So in worst case, we make x trials.

If it doesn’t break, we jump (x-1) floors (Because we have

already made one attempt and we don't want to go beyond

x attempts. Therefore (x-1) attempts are available),

Next floor we try is floor x + (x-1)

Similarly, if this drop does not break, next need to jump

up to floor x + (x-1) + (x-2), then x + (x-1) + (x-2) + (x-3)

and so on.

Since the last floor to be tried is 100'th floor, sum of

series should be 100 for optimal value of x.

x + (x-1) + (x-2) + (x-3) + .... + 1 = 100

x(x+1)/2 = 100

x = 13.651

Therefore, we start trying from 14'th floor. If Egg breaks

we one by one try remaining 13 floors. If egg doesn't break

we go to 27th floor.

If egg breaks on 27'th floor, we try floors form 15 to 26.

If egg doesn't break on 27'th floor, we go to 39'th floor.

An so on...

HOPE IT'S HELPFUL FOR YOU

Answered by mathdude500
9

\large\underline{\bold{ANSWER-}}

Let first start with one egg.

  • We have to first find the floor, from where this egg breaks

  • We start at the ground floor.

  • If the egg breaks there, then we’ve found the right floor. Otherwise, we get to keep our egg,

and

  • we can try again with the next higher floor.

  • Continuing on like this, the distance we can explore with 1 egg and 'n' tries is given by

\rm :\longmapsto\:d_{1}(n) = n \: where \:  n\geqslant 0 -  -  - (1)

Now,

  • Let’s use this relationship (1) to solve the two-egg problem,

where we start with 2 eggs and 'n' tries.

  • When we drop an egg from a floor and it breaks, we explore the required floor.

  • If first egg breaks, then we’re forced to explore the lower floors with second egg and 'n − 1' tries. But if the egg survives, then we can move on to the upper floors with 2 eggs and 'n − 1' tries.

So,

  • The total distance that we can explore with 2 eggs and 'n' tries is given by

\rm :\longmapsto\:d_2{(n)} = 1 + d_1{(n - 1)} + d_2{(n - 1)}

\rm :\longmapsto\:d_2{(n)} = 1 + (n - 1) + d_2{(n - 1)}

\rm :\longmapsto\:d_2{(n)} = n + d_2{(n - 1)}

Now,.

  • we can expand the above recurrence relation,

\rm :\longmapsto\:d_2{(n)} = n \:  +  \: (n - 1) + (n - 2) +  -  - + 1 + d_2{(0)}

Now,

  • we know,

\rm :\longmapsto\:d_2{(0)} = 0

So,

Above relation can be rewritten as

\rm :\longmapsto\:d_2{(n)} = n \:  +  \: (n - 1) + (n - 2) +  -  - + 1

Now,

  • RHS is an AP SERIES, so using sum of n terms of AP, we get

\rm :\longmapsto\:d_2(n) = \dfrac{n(n + 1)}{2}

Since,

  • we have given building of 100 floors, so we have

\rm :\longmapsto\:d_2(n) = 100

\rm :\implies\:\dfrac{n(n + 1)}{2}  = 100

\rm :\implies\: {n}^{2}  + n = 200

\rm :\longmapsto\: {n}^{2}  + n - 200 = 0

  • Its a quadratic equation in 'n', whose solution is given by

\rm :\longmapsto\:n = \dfrac{ - b  \: \pm \:  \sqrt{ {b}^{2} - 4ac } }{2a}

  • On substituting the values, we get

\rm :\longmapsto\:n = \dfrac{ - 1  \: \pm \:  \sqrt{ {1}^{2} - 4 \times 1 \times ( - 200) } }{2 \times 1}

\rm :\longmapsto\:n = \dfrac{ - 1 \:  \pm \:  \sqrt{801} }{2}

\rm :\longmapsto\:n = \dfrac{ - 1 \:  \pm \: 28.30}{2}

\bf\implies \:n = 13.65 \:  \:  \: or \:  \:  \: n \:  =  - 14.65 \: (rejected)

So,

  • with two eggs, the floor is 14th floor.

Similar questions