0840. Magic Squares In Grid
Last updated
Last updated
**Input:** grid = [[4,3,8,4],[9,5,1,9],[2,7,6,2]]
**Output:** 1
**Explanation:**
The following subgrid is a 3 x 3 magic square:

while this one is not:

In total, there is only one magic square inside the given grid.**Input:** grid = [[8]]
**Output:** 0**Input:** grid = [[4,4],[3,3]]
**Output:** 0**Input:** grid = [[4,7,8],[9,5,1],[2,3,6]]
**Output:** 0