comefrom: <doocs>0042.Trapping Rain Water_1.py
code: def trap( height: List[int]) -> int:
      n = len(height)
      if n < 3:
          return 0
      
      lmx, rmx = [height[0]] * n, [height[n - 1]] * n
      for i in range(1, n):
          lmx[i] = max(lmx[i - 1], height[i])
          rmx[n - 1 - i] = max(rmx[n - i], height[n - 1 - i])
      
      res = 0
      for i in range(n):
          res += min(lmx[i], rmx[i]) - height[i]
      return res
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 = len ( var_0 )
      if var_4 < 3 :
          return 0
      var_7 , var_9 = [ var_0 [ 0 ] ] * var_4 , [ var_0 [ var_4 - 1 ] ] * var_4
      for var_11 in range ( 1 , var_4 ) :
          var_7 [ var_11 ] = max ( var_7 [ var_11 - 1 ] , var_0 [ var_11 ] )
          var_9 [ var_4 - 1 - var_11 ] = max ( var_9 [ var_4 - var_11 ] , var_0 [ var_4 - 1 - var_11 ] )
      var_13 = 0
      for var_11 in range ( var_4 ) :
          var_13 += min ( var_7 [ var_11 ] , var_9 [ var_11 ] ) - var_0 [ var_11 ]
      return var_13
  