Maximal Square
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.
Maximal Square

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.

Example 1:
Input: [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Output: 4
Input
arr =[["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]

Initialize DP matrix with zeros

Input Matrix

1

0

1

0

0

1

0

1

1

1

1

1

1

1

1

1

0

0

1

0

DP Matrix (max square side)

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Position:

(-1, -1)

Max Side:

0

Max Area:

0

Current

Input 1

Max Square

Variables
No variables to display
DepthFunction Call
Stack empty
0/14