#3800

Minimum Cost to Make Two Binary Strings Equal

expert · 1035 · lc medium +32 · 38.7% accepted · 93 likes · top 18%

Description

Given two binary strings s and t of length n and costs flipCost, swapCost, crossCost, apply any mix of operations — flipping a single character in s or t (cost flipCost), swapping two characters within the same string (cost swapCost), or swapping s[i] with t[i] (cost crossCost) — and return the minimum total cost to make s equal t.

Code

1
2
3