Problem 3995 · Hard

Minimum Cost to Convert String III

Rewrite disjoint windows of the source with wildcard rules so the result equals the target. A prefix DP tracks the cheapest way to reach each position, with windows chosen one after another.

Open the interactive visualisation