It is giving me tle error
What will be the base case for this problem
hello @sreejan123
recursive solution will give tle because of exponential time complexity.
use dynamic programming to pass all test cases
then why this question is asked in recursion section
because it has recursive solution as well (same as urs).
try again after learning dp.
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.