Two test cases throwing TLE

Used top-down DP, please debug this code.

Hi @ksalokya
ur soln and approach are both correct… but recursive approach sometimes take slightly more time than the linear approach… and time limit of ques would have been set in such a way that’s why ur 2 test cases are failing…
try to do it in a linear bottom up way… it will pass all test cases…

alright thank a lot…

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.