Problem 656 · Hard

Coin Path

Work backwards to find the cheapest cost from each index, then walk forward taking the earliest index among equal costs.

Open the interactive visualisation