Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 474 Bytes

File metadata and controls

15 lines (11 loc) · 474 Bytes

Problem 18: The Maximal Square (Maximal Square)

Problem Statement

Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.

Input Format

  • A 2D binary matrix matrix.

Constraints

  • 1 <= m, n <= 300

Example

Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Output: 4
Explanation: The largest square has side 2, area = 4.