Largest Square Sub-matrix With All 1's

medium
1. You are given a matrix of 0's and 1's.
2. You have to find the maximum size square sub-matrix with all 1's.

Input Format

A number N, which represents number of rows in matrix A number M, which represents number of columns in matrix arr1 arr2...N*M numbers

Output Format

Check the sample output and question video.

Constraints

1 <= N,M <= 100
0<= arr[i][j] <= 1

Example

Input
5 6
0 1 0 1 0 1 
1 0 1 0 1 0 
0 1 1 1 1 0 
0 0 1 1 1 0 
1 1 1 1 1 1
Output
3
Previous
Highway Billboard
Next
Minimum Insertions To Make Palindrome

Related Questions