Tilling problem


It is showing time limit, can you pls suggest a better method pls

Use dynamic programming

I am sorry, I didnt get how to incorporate dynamic programming in this question, can you please elaborate

Approach: For a given value of n and m, the number of ways to tile the floor can be obtained from the following re

count(n) = | 1, 1 < = n < m ( base case)
| 2, n = m (base case)
| count(n-1) + count(n-m), m < n

memorize using a array of n+1 size nd use the above conditions

Check the saved code pls, I created the array of dynamic programming, now it is showing run error

I modified your code a bit. Check it out -


Tell me if you are able to understand it.

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.