1
/*
2
Logic Here used is:
3
- we need to find, max no of floors soluiton can be found with K egg by using m
4
move
5
- recursion will use like to find m moves no of floor count we need to add
6
dp[m-1][k-1] & dp[m-1][k];
7

8
*/
9

10
class Solution {
11
public:
12
int superEggDrop(int k, int n) {
13
vector<int> dp(k + 1, 0);
14
int m = 0;
15
while (dp[k] < n) {
16
m++;
17
for (int i = k; i >= 1; --i) {
18
dp[i] = dp[i] + dp[i - 1] + 1;
19
}
20
}
21
return m;
22
}
23
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0