comefrom: <doocs>0926.Flip String to Monotone Increasing_1.py
code: def minFlipsMonoIncr( s: str) -> int:
      n = len(s)
      left, right = [0] * (n + 1), [0] * (n + 1)
      ans = 0x3F3F3F3F
      for i in range(1, n + 1):
          left[i] = left[i - 1] + (1 if s[i - 1] == '1' else 0)
      for i in range(n - 1, -1, -1):
          right[i] = right[i + 1] + (1 if s[i] == '0' else 0)
      for i in range(0, n + 1):
          ans = min(ans, left[i] + right[i])
      return ans
masked: def sample_funcname ( var_0 : str ) -> int :
      var_4 = len ( var_0 )
      var_7 , var_8 = [ 0 ] * ( var_4 + 1 ) , [ 0 ] * ( var_4 + 1 )
      var_10 = 0x3F3F3F3F
      for var_12 in range ( 1 , var_4 + 1 ) :
          var_7 [ var_12 ] = var_7 [ var_12 - 1 ] + ( 1 if var_0 [ var_12 - 1 ] == '1' else 0 )
      for var_12 in range ( var_4 - 1 , - 1 , - 1 ) :
          var_8 [ var_12 ] = var_8 [ var_12 + 1 ] + ( 1 if var_0 [ var_12 ] == '0' else 0 )
      for var_12 in range ( 0 , var_4 + 1 ) :
          var_10 = min ( var_10 , var_7 [ var_12 ] + var_8 [ var_12 ] )
      return var_10
  