Problem 135 · Hard

Candy

Two passes left-to-right and right-to-left to enforce neighbor rating constraints.

Open the interactive visualisation