I was able to solve using dynamic programming,but i wanted to ask why time limit exceeding in matrix exponentiation method as its tym complexity is O(logn)…while that of dp is O(n)???
Tilling problem
Hi,
It might be possible that you were making a matrix of size order of m or n. Although time complexity of matrix exponentiation is O(logN) but with the high constant factor that won’t affect anything here.
If you share your code here, I would be able to help.
Thanks,
Yeah he’s right…
https://ide.codingblocks.com/s/169451 …this is using dp…this is perfectly working…but https://ide.codingblocks.com/s/169471 this one is using matrix expo…nd not working
THis question was to be solved with DP only.
Good work