Egg Drop

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. You are given two integers N and K. N represents the number of eggs and K represents the number of floors in a building.
2. You have to find the minimum number of attempts you need in order to find the critical floor in the worst case while using the best strategy.
3. The critical floor is defined as the lowest floor from which you drop an egg and it doesn't break.
4. There are certain which you have to follow -
a. All eggs are identical.
b. An egg that survives a fall can be used again.
c. A broken egg can't be used again.
d. If the egg doesn't break at a certain floor, it will not break at any floor below.
e. If the egg breaks at a certain floor, it will break at any floor above.
Input Format
Two integers N and K
Output Format
Check the sample output and question video.
Question Video
1 <= N <= 100
1 <= k <= 50
Sample Input
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name