Back

maximum square sub matrix with all 1's

Created 2 years ago
24 Views
0 Comments
SakthivelHmOLkh
@SakthivelHmOLkh
SakthivelHmOLkh
@SakthivelHmOLkhProfile is locked. Login

Given a binary matrix of size N * M consisting only 0s and 1s, find the maximum size square submatrix with all 1s.
Input Size : N<=1000, M<=1000
Example: Consider the below matrix.
INPUT
6 5
0 1 1 0 1
1 1 0 1 0
0 1 1 1 0
1 1 1 1 0
1 1 1 1 1
0 0 0 0 0
OUTPUT
1 1 1
1 1 1
1 1 1
NOTE
The maximum square sub-matrix with all ’1′ bits is from (2,1) to (4,3)

Comments
Please login to comment.