chefzot problem

I’ve done CHEFZOT problem It’s givving wrong answer when submitted.I’ve seen editorial and my solution is bit different but givving exact output on all the given test cases.Please tell me why it’s givving “wrong answer”.

what if all array elements are non-zero like
1 2 3 4 5 6
check the output and try to rectify it

where is the link of your code?