Tilling Problem

Why it is showing Tle.

hello @rohit2299
ur solution time complexity is exponential thats why it is giving tle.

to optimise it we will use dynamic programming.
if ur are not aware of it then leave this problem for now and try later after learning dp

i used dp,is this the correct way

@rohit2299
a) m is redundant dp state .linear array will work
b) use long long in place of int
c) use modulo property i.e (a+b)%mod=(a%mod+b%mod)%mod