This is my code for tiling problem 2. I am getting runtime error in most of the cases. Need help in finding where I am going wrong.
I am getting runtime error
The code in res is wrong
it should look something like
long long dp[N+1];
dp[0]=dp[1]=1;
for(int i=2;i<=N;i++)
if(i>=M)
dp[i]=(dp[i-1]+dp[i-M])%C;
else
dp[i]=dp[i-1];
return dp[N];