Example 73: Largest Square Submatrix with All 1s
Learn how to find the largest square submatrix with all 1s.
We'll cover the following...
Problem
Given a matrix that contains only 1s and/or 0s, write a program to obtain the order of the largest square submatrix with all 1s.
Example
Input | Output |
---|---|
1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 |
3 |
0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 |
1 |
Try it yourself
...Access this course and 1400+ top-rated courses and projects.