3800. Minimum Cost to Make Two Binary Strings Equal
You are given two binary strings
sandt, both of lengthn, and three positive integersflipCost,swapCost, andcrossCost.You are allowed to apply the following operations any number of times (in any order) to the strings
sandt:
- Choose any index
iand flips[i]ort[i](change'0'to'1'or'1'to'0'). The cost of this operation isflipCost.- Choose two distinct indices
iandj, and swap eithers[i]ands[j]ort[i]andt[j]. The cost of this operation isswapCost.- Choose an index
iand swaps[i]witht[i]. The cost of this operation iscrossCost.Return an integer denoting the minimum total cost needed to make the strings
sandtequal.
1 | class Solution { |