You are given a s of length n.
You can perform two types of operations on s any number of times:
Invert the prefix of s from index i with a cost of i
Invert the suffix of s from index i to index n n i.
Inverting a substring means toggling every character in that range, changing '0' to '1' and '1' to '0'.
Return the minimum total cost to make all characters in s equal.
Constraints:
s.length n
s[i] is either '0' or '1'
You are given a s of length n.
You can perform two types of operations on s any number of times:
Invert the prefix of s from index i with a cost of i
Invert the suffix of s from index i to index n n i.
Inverting a substring means toggling every character in that range, changing '0' to '1' and '1' to '0'.
Return the minimum total cost to make all characters in s equal.
Constraints:
s.length n
s[i] is either '0' or '1'