Problem 3919 · Medium

Minimum Cost to Move Between Indices

Each index has one nearest neighbour by value. A cheapest-route search mixes direct value-gap jumps with one-cost neighbour hops.

Open the interactive visualisation