Tap here to switch tabs
Problem
Submissions

Problem: Magic Squares In Grid

med
30 min
Try to solve the Magic Squares In Grid problem.

Statement

A 3×33 \times 3 magic square is a 3×33 \times 3 grid filled with distinct numbers from 11 to 99 such that every row, every column, and both diagonals share the same sum.

Given a row × col integer matrix grid, return the total number of contiguous 3×33 \times 3 magic square subgrids within grid.

Constraints:

  • row == grid.length

  • col == grid[i].length

  • 1≤1 \leq row, col ≤10\leq 10

  • 0≤0 \leq grid[i][j] ≤15\leq 15

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Magic Squares In Grid

med
30 min
Try to solve the Magic Squares In Grid problem.

Statement

A 3×33 \times 3 magic square is a 3×33 \times 3 grid filled with distinct numbers from 11 to 99 such that every row, every column, and both diagonals share the same sum.

Given a row × col integer matrix grid, return the total number of contiguous 3×33 \times 3 magic square subgrids within grid.

Constraints:

  • row == grid.length

  • col == grid[i].length

  • 1≤1 \leq row, col ≤10\leq 10

  • 0≤0 \leq grid[i][j] ≤15\leq 15