Sizga m x n o'lchamdagi butun sonlardan iborat heightMap matritsasi berilgan. Unda har bir hujayra (cell) ma'lum balandlikda joylashgan ustunni bildiradi. Yomg'ir yog'gandan so'ng bu matritsada necha birlik suv jamg'arilishi mumkinligini hisoblang.
func solve(heightMap [][]int) int {
// ...
}
Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
Output: 4
Input: heightMap = [[3,3,3,3,3],[3,2,2,2,3],[3,2,1,2,3],[3,2,2,2,3],[3,3,3,3,3]]
Output: 10
Input: heightMap = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]
Output: 1
Input: heightMap = [[5, 5], [5, 5]]
Output: 0