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_1 = len ( var_0 )
      if var_1 < 3 :
          return 0
      var_2 , var_3 = [ var_0 [ 0 ] ] * var_1 , [ var_0 [ var_1 - 1 ] ] * var_1
      for var_4 in range ( 1 , var_1 ) :
          var_2 [ var_4 ] = max ( var_2 [ var_4 - 1 ] , var_0 [ var_4 ] )
          var_3 [ var_1 - 1 - var_4 ] = max ( var_3 [ var_1 - var_4 ] , var_0 [ var_1 - 1 - var_4 ] )
      var_5 = 0
      for var_4 in range ( var_1 ) :
          var_5 += min ( var_2 [ var_4 ] , var_3 [ var_4 ] ) - var_0 [ var_4 ]
      return var_5
  