https://www.codechef.com/viewsolution/26626602
Only some testcases are showed correct. Can anyone help me with the issue? I have used dp with 2d array and prefix sum in each row.
https://www.codechef.com/viewsolution/26626602
Only some testcases are showed correct. Can anyone help me with the issue? I have used dp with 2d array and prefix sum in each row.
Since k < n is also possible you should calculate your result like this –
…
int sum=1;
int z = min(n, k);
for(i=0;i<z;i++)sum=(sum+dp[i][n-1])%M;