Candy

Go through the vector ratings twice. First from left to right, rate
increasing sub-array; then go from right to left, modify rates for
increasing sub-array when the rates were not increased accordingly.