0750. Number Of Corner Rectangles
Last updated
Last updated
https://leetcode.com/problems/number-of-corner-rectangles
Given an m x n
integer matrix grid
where each entry is only 0
or 1
, return the number of corner rectangles.
A corner rectangle is four distinct 1
's on the grid that forms an axis-aligned rectangle. Note that only the corners need to have the value 1
. Also, all four 1
's used must be distinct.
Example 1:
Example 2:
Example 3:
Constraints:
m == grid.length
n == grid[i].length
1 <= m, n <= 200
grid[i][j]
is either 0
or 1
.
The number of 1
's in the grid is in the range [1, 6000]
.