Ezvor

3253. Construct String with Minimum Cost (Easy)

Medium Preparing judge… LeetCode

Hints

Hint 1
Let dp[i] denote the minimum cost to make s equal to the prefix of target of length i.
Hint 2
dp[i] = min(costs[k] + dp[j]), where j > i and words[k] == target[i..j].