Showing TLE error

@shivank.agg.sa your logic is fine but for string length = 25; the Time complexity is 2^25 which is very large. So you need to use Dynamic programming. If you haven’t studied DP yet then leave this question for a while.

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.