Minimum Number of Coins for Fruits II
Buying a fruit makes the next few fruits free. Scan from the back with a monotone deque to find the cheapest total cost for every fruit.
Buying a fruit makes the next few fruits free. Scan from the back with a monotone deque to find the cheapest total cost for every fruit.