Unable to do the question


here is my code pls debug it and pls comment the wrong thing ,thnk u

Bro your submission is 100% now, i hope you solved your doubt on your own.

hmm but i have done it by another method (the method taught in class) but acc to my code it was giving tle in one test case so pls pls check !!!

See for this test case:
5
3
4
5
1
2
2
Expected output:4
Yours is giving TLE

You are also aware of correct logic now, so you can proceed accordingly.

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.