Problem 3502 · Easy

Minimum Cost to Reach Every Position

For each position, the cheapest way to reach it is the smallest cost seen up to that point, so a running minimum answers every position in one pass.

Open the interactive visualisation