===== ISTEM =====
Solve the following programming task.

TASK: Trapping Rain Water

Write a function 'trap_rain_water(height)' that takes an array of heights and computes how many units of water can be trapped between the blocks after it rains.

STARTER CODE (python):
def trap_rain_water(height: list[int]) -> int:
    # Write your code here
    pass


RULES:
- Keep the function name and signature EXACTLY as given.
- Return working code only. No explanations.
- Put the code in a single ``` block.
- Try to solve it first. If you genuinely cannot, write only this single
  line instead of producing faulty code: CANNOT_SOLVE

===== HAM YANIT =====
```python
def trap_rain_water(height: list[int]) -> int:
    if not height:
        return 0

    n = len(height)
    left_max = [0] * n
    right_max = [0] * n
    water_trapped = 0

    left_max[0] = height[0]
    for i in range(1, n):
        left_max[i] = max(left_max[i-1], height[i])

    right_max[n-1] = height[n-1]
    for i in range(n-2, -1, -1):
        right_max[i] = max(right_max[i+1], height[i])

    for i in range(n):
        water_trapped += min(left_max[i], right_max[i]) - height[i]

    return water_trapped
```