Problem 3253 · Easy

Construct String with Minimum Cost (Easy)

Fill a prefix-cost table left to right: each word that matches at a reachable position offers a cheaper route to a longer prefix.

Open the interactive visualisation