You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You want to fit a big square into the empty space (denoted by zeros). What is the largest empty square sub-matrix you can find in the given matrix? You will return the row and column extent of the sub-matrix. The answer may not be unique. We will test that your sub-matrix is square, that it is empty, and that it contains the correct number of elements.
Example:
Input a = [ 1 0 0
0 0 0
0 0 0 ]
Output si = [ 2 3 2 3 ]
That is, the square indices are a(2:3,2:3). We verify that sum(sum(a(2:3,2:3))) is zero, and that it has four elements.
Solution Stats
Problem Comments
8 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers501
Suggested Problems
-
2361 Solvers
-
1304 Solvers
-
17976 Solvers
-
Integer Sequence - II : New Fibonacci
676 Solvers
-
5146 Solvers
More from this Author54
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
There appears to be an error is Test Suite #3.
Agree, len for Test Suite 3 should be 4 not 3.
Yes. Fixed it.
Very exciting, as always with Ned
Good puzzle!
Challenging like all the other problems set in the ASEE Challenge
Nice!
Test suite has been updated with unsymmetrical matrices.
The original problem description/statement doesn't mention any restriction on the input matrix size.