https://www.codechef.com/viewsolution/26747582
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.