comefrom: <doocs>0487.Max Consecutive Ones II_1.py
code: def findMaxConsecutiveOnes( nums: List[int]) -> int:
      n = len(nums)
      prefix = [0] * n
      suffix = [0] * n
      res = 0
      for i in range(n):
          if i == 0:
              prefix[i] = nums[i]
          else:
              prefix[i] = 0 if nums[i] == 0 else prefix[i - 1] + 1
          res = max(res, prefix[i])
      
      for i in range(n - 1, -1, -1):
          if i == n - 1:
              suffix[i] = nums[i]
          else:
              suffix[i] = 0 if nums[i] == 0 else suffix[i + 1] + 1
      
      for i in range(n):
          if nums[i] == 0:
              t = 1
              if i > 0:
                  t += prefix[i - 1]
              if i < n - 1:
                  t += suffix[i + 1]
              res = max(res, t)
      return res
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 = len ( var_0 )
      var_6 = [ 0 ] * var_4
      var_7 = [ 0 ] * var_4
      var_8 = 0
      for var_10 in range ( var_4 ) :
          if var_10 == 0 :
              var_6 [ var_10 ] = var_0 [ var_10 ]
          else :
              var_6 [ var_10 ] = 0 if var_0 [ var_10 ] == 0 else var_6 [ var_10 - 1 ] + 1
          var_8 = max ( var_8 , var_6 [ var_10 ] )
      for var_10 in range ( var_4 - 1 , - 1 , - 1 ) :
          if var_10 == var_4 - 1 :
              var_7 [ var_10 ] = var_0 [ var_10 ]
          else :
              var_7 [ var_10 ] = 0 if var_0 [ var_10 ] == 0 else var_7 [ var_10 + 1 ] + 1
      for var_10 in range ( var_4 ) :
          if var_0 [ var_10 ] == 0 :
              var_13 = 1
              if var_10 > 0 :
                  var_13 += var_6 [ var_10 - 1 ]
              if var_10 < var_4 - 1 :
                  var_13 += var_7 [ var_10 + 1 ]
              var_8 = max ( var_8 , var_13 )
      return var_8
  