whast wrong with my code ???
not passing test cases
whast wrong with my code ???
not passing test cases
Hey @hg11110000
int dp[100001]; //need bigger dp array
int f(int n, int m)
{
if (n < m) return dp[n] = 1;
if (dp[n] != -1) return dp[n];
return dp[n] = (f(n - 1, m)%1000000007 + f(n - m, m)%1000000007)%1000000007; //apply modulo here to avoid overfow
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.