Suppose you have N eggs and you want to determine from which floor in a K-floor building you can drop an egg such that it doesn't break. You have to determine the minimum number of attempts you need in order find the critical floor in the worst case while using the best strategy.There are few rules given below.
For more description on this problem see wiki page
Input: N = 2, K = 10 Output: 4
Input: N = 3, K = 5 Output: 3
Complete the function eggDrop() which takes two positive integer N and K as input parameters and returns the minimum number of attempts you need in order to find the critical floor.
Expected Time Complexity : O(N*K)
Expected Auxiliary Space: O(N*K)
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes