Encountering TLE error

Even after applying bottom up dp, it isnt working. Kindly Find the error.

@sr30
hello Saurabh,
you dp state is wrong , m is always fixed.

simple bottom up approach will be
dp[i]=dp[i-m]+dp[i-1]

also use modular arithmetic property while performing addition

Its showing wrong output: https://ide.codingblocks.com/s/208205

check this->


a) removed m!=1
b) replaced dp[i]=dp[i]+dp[i-m]%c with dp[i]=(dp[i]+dp[i-m])%ct