Tap here to switch tabs
Problem
Submissions

Problem: Maximum Area of Two Non-Overlapping Square Submatrices

Maximum Area of Two Non-Overlapping Square Submatrices asks you to find two non-overlapping, equal-sized squares of ones in a binary grid and return the largest possible area, or zero if none exist.

Statement

You are given an m×nm \times n binary grid mat.

Find two non overlapping square submatrices of equal side length containing only 11s such that the area of each square is maximized. Return the maximum possible area of one such square submatrix. If it is impossible to find two non overlapping squares containing only 11s, return 00.

Note: Two square submatrices are non overlapping if they do not share any common cells.

Constraints:

  • mat.length =m= m

  • mat[i].length =n= n

  • 1≤m,n≤5001 \leq m, n \leq 500

  • mat[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Area of Two Non-Overlapping Square Submatrices

Maximum Area of Two Non-Overlapping Square Submatrices asks you to find two non-overlapping, equal-sized squares of ones in a binary grid and return the largest possible area, or zero if none exist.

Statement

You are given an m×nm \times n binary grid mat.

Find two non overlapping square submatrices of equal side length containing only 11s such that the area of each square is maximized. Return the maximum possible area of one such square submatrix. If it is impossible to find two non overlapping squares containing only 11s, return 00.

Note: Two square submatrices are non overlapping if they do not share any common cells.

Constraints:

  • mat.length =m= m

  • mat[i].length =n= n

  • 1≤m,n≤5001 \leq m, n \leq 500

  • mat[i][j] is either 00 or 11.