Two test cases failing

Here is my code.


Please help me to find the error.

@S18ML0001
I see you have received 100 already
So I’m closing this doubt

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.

Full score solution was as a result of discussion on discuss but i still do want to know what is the issue in this code.

@S18ML0001
In that case I request you to reopen the doubt if you haven’t already done that

Hey @S18ML0001
Your logic is incorrect
You are trying to solve this problem greedily but this is a problem and your logic will fail
Please see this for explanation and solution https://ide.codingblocks.com/s/224331

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.