You are given a binary string s representing a train sequence of cars. A character $'1'$ signifies that the car contains illegal goods, while a character $'0'$ signifies that it does not.
You need to remove every car containing illegal goods. You may perform any of the following operations:
Remove a car from the left end of the sequence, taking
Remove a car from the right end of the sequence, taking
Remove a car from any position in the sequence, taking
Return the minimum total time required to remove all cars containing illegal goods.
Constraints:
s.length
s[i] is either $'0'$ or $'1'$.
You are given a binary string s representing a train sequence of cars. A character $'1'$ signifies that the car contains illegal goods, while a character $'0'$ signifies that it does not.
You need to remove every car containing illegal goods. You may perform any of the following operations:
Remove a car from the left end of the sequence, taking
Remove a car from the right end of the sequence, taking
Remove a car from any position in the sequence, taking
Return the minimum total time required to remove all cars containing illegal goods.
Constraints:
s.length
s[i] is either $'0'$ or $'1'$.