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. Output the minimum number of drops required to figure out N.

Answer: 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 tired 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…