Wrong Answer Accepted by CodeChef

I solved a question named Interesting Subarray (SUBARRY) in the September Long Challenge 2022 (SEP221C) and came up with this solution.

But after noticing a bit, I got to know that my code is missing on many test cases…precisely, the test cases in which an array is there with maximum element 0 and rest of the elements are negative numbers…

The astonishing thing is that CodeChef accepted this solution. It is missing on a whole segment of test cases (arrays with maximum element 0)… :slightly_smiling_face:

I corrected my code and changed it to this. The only difference is on line 52 :sweat_smile: in the else if condition.

My request is to CodeChef (@admin) is to take care of this in future and diversify the test cases…

2 Likes