human
Give me a Python code to compute how much water it is able to trap after raining given the following:
I found an interesting problem on https://leetcode.com/problems/trapping-rain-water/:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image!

Example:

Input: [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is Python code to compute how much water it is able to trap after raining.

class Solution:
     def trap(self, height):
         """
         :type height: List[int]
         :rtype: int
         """
         
         # sol1: mono stack
         
         # sol2: heap
         
         l_bounds = []
         lb = float('-inf')
         for h in height:
             lb = max(lb, h)
             l_bounds.append(lb)
             
         water = 0
         rb = float('-inf')
         for lb, h in zip(reversed(l_bounds), reversed(height)):
             rb = max(rb, h)
             water += min(lb, rb) - h
         return water