Tilling problem-II

Please check whether the following code for tiling problem using recursion is correct:
Only 1 Test case passed,

Hi @shorya
I can see u have successfully submitted the solution and gained full points… what issue are u facing??

I solved it iteratively but here i am trying recursive approach.

Hi… the constraints are large so you can’t apply brute force recursion as it will give you TLE. So do this question with bottom-up approach only.

Its not giving tle, its giving WA. Plus I am using memoization.

image
ok so after every test case reset the dp array to -1… else previous test case value of dp table would be getting used again… rest ur code is fine…
corrected code --> https://ide.codingblocks.com/s/617991

ohh got it
thanks alot

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.