You are given an m n integer matrix grid.
An hourglass is defined as a subset of elements from grid forming the following structure:grid[r][c], grid[r][c + 1], grid[r][c + 2]grid[r + 1][c + 1]grid[r + 2][c], grid[r + 2][c + 1], grid[r + 2][c + 2]
Return the maximum sum of elements among all valid hourglasses in grid.
Note: An hourglass cannot be rotated and must be fully contained within the grid boundaries.
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j]
You are given an m n integer matrix grid.
An hourglass is defined as a subset of elements from grid forming the following structure:grid[r][c], grid[r][c + 1], grid[r][c + 2]grid[r + 1][c + 1]grid[r + 2][c], grid[r + 2][c + 1], grid[r + 2][c + 2]
Return the maximum sum of elements among all valid hourglasses in grid.
Note: An hourglass cannot be rotated and must be fully contained within the grid boundaries.
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j]