WA in ZCO15001

Can someone tell me why my solution to ZCO15001 fails on two test cases?
Thank you very much.

Consider the testcase:

0 0 0 1 0

Answer should be 2, your code outputs 3.

1 Like

I just had a look at the editorial to this. Turns out my algorithm was wrong.
I am surprised by the number of test cases it passed even though the algorithm was wrong.
Anyway, thanks!