I have problem in converting the o/p to mod value probably can you please check
Tiling problem II
@deepna
hello deepna,
ur code is not correct.
recurrence relation will we
tile(n,m)= tile(n-1,m) + tile(n-m,m)
-> base case will be
if(n<m ) then return 1
if n==m return 2
Now because In problem it is mentioned to take modulo we will use modulo property
property-> (a+b)%mod= (a%mod+b%mod)%mod
using this property we can write above recurrence relation as
tile(n,m) % mod=( tile(n-1,m) % mod + tile(n-m,m) % mod ) % mod
still getting tle
@deepna
yeah because its complexity is high .
to optimise it we will use dynamic programming. if u r not aware of it then u can try this after learning dp
okay thankyou…I will see it afterwards