EXERCISE - September CookOff


Can anyone help me with this, please?
I couldn’t find what is wrong with this approach. Maybe it is failing some boundary case.

I made two variables ‘miv’ and ‘mav’, which tells us about the minimum and maximum possible value of the next element in the array, given the previous ones and the corresponding sign. I went through the array and checked if at any stage it was impossible to assign any number to that index.
P.S. At least it is passing the example inputs.

change max to 1e9.
your code would fail on
-1 -1 -1 -1 -1 1e6

My code is giving NO as output for this test case, which I think should be correct. A[i] is less than 1e6+1 for all i.

That is the constraint on input A[i], there is no constraint on the values you can assign to -1s. I made the same mistake during round