[InterviewBit] Egg Drop Problem!

Egg Drop Problem!

  • Time :
  • Space :
1
2
3
4
5
6
7
8
int Solution::solve(int n, int k) {
int dp[10101][101] = {}, m = 0;
while(dp[m][n] < k) {
m++;
for (int x = 1; x <= n; x++) dp[m][x] = 1 + dp[m - 1][x - 1] + dp[m - 1][x];
}
return m;
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2022/09/08/PS/interviewbit/egg-drop-problem/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.