Since only the negative numbers have the ability to change signs, you need to count how many negative numbers are there in your array. If you have at least one positive number, the result can be incremented by one if you place that positive number at the start of your array.

Statistics

62% Solution Ratio
mh755628Earliest, Feb '20
user.5732Fastest, 0.0s
mh755628Lightest, 131 kB
mdvirusShortest, 186B
Toph uses cookies. By continuing you agree to our Cookie Policy.