For smaller inputs its working fine but i am not able to identify issues
Hi @akshitmehta
You are getting time limit exceeded in test cases because for large value of n and smaller m there are many over lapping sub problems because each time tiling function call itself two time. Instead of this you must use the following approach.
For a given value of n and m, the number of ways to tile the floor can be obtained from the following relation.
count(n) = 1, when 1<=n<m
count(n) = 2, when n = m
count(n) = count(n-1) + count(n-m), when m < n
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.