Egg dropping problem -dynamic programming

why we take maximum of the two cases
egg is breaked
egg is not breaked

i am asking the recursive solution of this problem

Hi Shubham,
in this problem we have to take the maximum of the two cases :

  1. if the egg breaks after dropping from xth floor
  2. if the egg doesn’t breaks after dropping from xth floor

because we are supposed to minimize the no. of trials for the worst case.

We will the max of above two cases for every floor (because we have to minimize the no. of trials for the worst case not the best case) and in all these recursion calls we will choose the floor which yields minimum number of trials.

Hope this helps you in getting why the max of two cases is taken :slight_smile:

why are we taking max??plz elaborate…