Minimum Time to Remove All Cars Containing Illegal Goods
You are given a binary string representing a sequence of cars. The '0's and '1's in the string represent cars without and with illegal goods, respectively. You need to remove all the cars containing illegal goods, and the goal is to minimize the time it takes to do so. Removing a car from either end takes 1 unit of time, and removing a car from the middle takes 2 units of time. Find the minimum time required to remove all cars containing illegal goods.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)