TLE in 4 test cases

code is giving tle on many test cases (code - “https://ide.codingblocks.com/s/84856”) so is there any optimisation in recursion?

@Ayusinha hey ayush you should try this code with dynamic programming because test case is so large and this lead to give you tle

but i dont know much about DP

@Ayusinha skip for now when you reach to dp section then try It would be eaiser to you to implement.

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.