You are given two binary strings s1 and s2 of length n, and an integer x.
You can apply any of the following two operations on s1 any number of times:
Select two distinct indices i and j such that s1[i] and s1[j]. This operation costs x.
Select an index i such that s1[i] and s1[i + 1]. This operation costs
Return the minimum total cost needed to make s1 identical to s2, or
Note: Inverting a character changes
to and to .
Constraints:
n s1.length s2.length
n, x
s1 and s2 consist only of the characters
You are given two binary strings s1 and s2 of length n, and an integer x.
You can apply any of the following two operations on s1 any number of times:
Select two distinct indices i and j such that s1[i] and s1[j]. This operation costs x.
Select an index i such that s1[i] and s1[i + 1]. This operation costs
Return the minimum total cost needed to make s1 identical to s2, or
Note: Inverting a character changes
to and to .
Constraints:
n s1.length s2.length
n, x
s1 and s2 consist only of the characters