<doocs>2167.Minimum Time to Remove All Cars Containing Illegal Goods_1.py
def minimumTime( s: str) -> int:
    n = len(s)
    pre = [0] * (n + 1)
    suf = [0] * (n + 1)
    for i, c in enumerate(s):
        pre[i + 1] = pre[i] if c == '0' else min(pre[i] + 2, i + 1)
    for i in range(n - 1, -1, -1):
        suf[i] = suf[i + 1] if s[i] == '0' else min(suf[i + 1] + 2, n - i)
    return min(a + b for a, b in zip(pre[1:], suf[1:]))
def sample_funcname ( var_0 : str ) -> int :
    var_4 = len ( var_0 )
    var_7 = [ 0 ] * ( var_4 + 1 )
    var_8 = [ 0 ] * ( var_4 + 1 )
    for var_10 , var_11 in enumerate ( var_0 ) :
        var_7 [ var_10 + 1 ] = var_7 [ var_10 ] if var_11 == '0' else min ( var_7 [ var_10 ] + 2 , var_10 + 1 )
    for var_10 in range ( var_4 - 1 , - 1 , - 1 ) :
        var_8 [ var_10 ] = var_8 [ var_10 + 1 ] if var_0 [ var_10 ] == '0' else min ( var_8 [ var_10 + 1 ] + 2 , var_4 - var_10 )
    return min ( var_16 + var_17 for var_16 , var_17 in zip ( var_7 [ 1 : ] , var_8 [ 1 : ] ) )
