What will be the error in this? i am not able to clear all test cases and let me know what i need to change it herre..?

Hello @shubhankar1996.dob1 for your logic see the correct code here:
https://ide.codingblocks.com/s/393731
if you have any doubt you can ask here:
Happy Learning!!

HiTushar
I am still getting TLE WITH two test cases

Hello @shubhankar1996.dob1 actually in that code i forgot to make the use of DP .
i have now correected the code:
it is passsing every test case:


if you have any doubt you can ask here:
Happy Learning!!

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.