Search⌘ K
AI Features

Solution: Trapping Rain Water II

Let's solve the Trapping Rain Water II problem using the Heaps pattern.

Statement

Given an m×nm \times n integer matrix heightMap, where each cell represents the height of a unit cell in a 2D elevation map, return the total volume of water that can be trapped after raining.

Constraints:

  • m == ...