Problem 2944 · Medium

Minimum Number of Coins for Fruits

Buying fruit i frees the next i fruits, so a backward table of the cheapest finish from each purchase gives the answer.

Open the interactive visualisation