Problem 2976 · Medium

Minimum Cost to Convert String I

Treat the 26 letters as graph nodes, run Floyd-Warshall for the cheapest conversion between every pair, then sum the cost per position.

Open the interactive visualisation