Even after applying bottom up dp, it isnt working. Kindly Find the error.
Encountering TLE 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
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