0840. Magic Squares In Grid
Last updated
Last updated
https://leetcode.com/problems/magic-squares-in-grid
A 3 x 3
magic square is a 3 x 3
grid filled with distinct numbers from 1
to 9
such that each row, column, and both diagonals all have the same sum.
Given a row x col
grid
of integers, how many 3 x 3
"magic square" subgrids are there? (Each subgrid is contiguous).
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
row == grid.length
col == grid[i].length
1 <= row, col <= 10
0 <= grid[i][j] <= 15