Only test case 0 is pass
@deepgarg46 You are getting TLE bcoz this question requires Dynamic Programming to be solved in time limit. So if you haven’t done dynamic programming till now leave this for now. Otherwise apply DP here.
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.