2428. Maximum Sum of an Hourglass
Medium
Previous2419. Longest Subarray With Maximum Bitwise ANDNext2441. Largest Positive Integer That Exists With Its Negative
Last updated
Medium
Last updated
You are given an m x n
integer matrix grid
.
We define an hourglass as a part of the matrix with the following form:
Return the maximum sum of the elements of an hourglass.
Note that an hourglass cannot be rotated and must be entirely contained within the matrix.
Example 1:
Example 2:
Constraints:
m == grid.length
n == grid[i].length
3 <= m, n <= 150
0 <= grid[i][j] <= 10^6