A farmer owns a rectangular grid grid of size
A pyramidal plot of height
The apex cell
For each level
The height
An inverse pyramidal plot of height
The apex cell
For each level
The height
Return the total count of all pyramidal and inverse pyramidal plots present in grid.
Constraints:
m == grid.length
n == grid[i].length
m, n
m $ imes$ n
grid[i][j] is either
A farmer owns a rectangular grid grid of size
A pyramidal plot of height
The apex cell
For each level
The height
An inverse pyramidal plot of height
The apex cell
For each level
The height
Return the total count of all pyramidal and inverse pyramidal plots present in grid.
Constraints:
m == grid.length
n == grid[i].length
m, n
m $ imes$ n
grid[i][j] is either