Tap here to switch tabs
Problem
Submissions

Problem: Maximum Area of Two Non-Overlapping Square Submatrices

Try to solve the Maximum Area of Two Non-Overlapping Square Submatrices problem.

Statement

You are given an mimesnm imes 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

Try to solve the Maximum Area of Two Non-Overlapping Square Submatrices problem.

Statement

You are given an mimesnm imes 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.