Why am I getting error how to resolve it

link to code https://ide.codingblocks.com/s/201765

int count[n + 1];
count[0] = 0;

for (int i = 1; i <= n; i++) { 
    if (i > m) 
        count[i] = count[i - 1] + count[i - m]; 

    else if (i < m) 
        count[i] = 1; 
    else
        count[i] = 2; 
} 
return count[n]; 

use a single loop
dont know why ur logic is failing

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.