Tiling problem2

error

Hey @nmaurya760
error is on line 13 it should be ans=ways(n-1,m)+ways(n-m,m-1);

after the changes my code is running for 1 test case and for others it is giving tle

Yeah because this is recursion and will give tle,told you the corrections in your memoization code in your other doubt

so for every question are we supposed to do memoization for avoiding tle

When its a DP question or required by the question. Because right now complexity will be exponential.

1 Like