Problem 1648 · Medium

Sell Diminishing-Valued Colored Balls

Each sale takes the colour with the most balls left, because a ball sells for the current count of its colour.

Open the interactive visualisation