TLE Error shown by compiler in 4/5 Test cases

The compiler shows TLE Error, is it because the test cases are big and since the solution is not optimized using DP?
If so, why has this question put in the Recursion section, DP has yet not been taught

Hello @anshufirefox yes this is the reason only that for this you need the optimized solution .
it is there in the recursion because you can do it later from here when you will be able to solve dp questions.
Happy Learning!!

Thank you :slight_smile:

@anshufirefox you can mark this doubt as resolved.

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.