Cody

# Problem 658. Find the biggest empty box

Solution 1997257

Submitted on 31 Oct 2019 by Tung Nguyen
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = [1 0; 0 0]; [r1,r2,c1,c2] = biggest_box(a); sub = a(r1:r2,c1:c2); [m,n] = size(sub); len = 1; assert(isequal(sum(sub(:)),0)) assert(isequal(m,len)); assert(isequal(n,len));

d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 1 d = 1 1 d = 1 2 d = 1 1

2   Pass
a = [1 0 0; 0 0 0; 0 0 0]; [r1,r2,c1,c2] = biggest_box(a); sub = a(r1:r2,c1:c2); [m,n] = size(sub); len = 2; assert(isequal(sum(sub(:)),0)) assert(isequal(m,len)); assert(isequal(n,len));

d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 1 d = 3 2 d = 3 1 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1

3   Pass
a = eye(9); [r1,r2,c1,c2] = biggest_box(a); sub = a(r1:r2,c1:c2); [m,n] = size(sub); len = 4; assert(isequal(sum(sub(:)),0)) assert(isequal(m,len)); assert(isequal(n,len));

d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 8 d = 1 9 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 8 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 8 d = 2 9 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 8 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 8 d = 3 9 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 8 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 1 d = 3 2 d = 3 3 d = 3 1 d = 3 2 d = 3 1 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 8 d = 4 9 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 8 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 1 d = 4 2 d = 4 3 d = 4 1 d = 4 2 d = 4 1 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 8 d = 5 9 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 8 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 1 d = 5 2 d = 5 3 d = 5 1 d = 5 2 d = 5 1 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 7 d = 6 8 d = 6 9 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 7 d = 6 8 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 7 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 1 d = 6 2 d = 6 3 d = 6 1 d = 6 2 d = 6 1 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 7 d = 7 8 d = 7 9 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 7 d = 7 8 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 7 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 1 d = 7 2 d = 7 3 d = 7 1 d = 7 2 d = 7 1 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 5 d = 8 6 d = 8 7 d = 8 8 d = 8 9 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 5 d = 8 6 d = 8 7 d = 8 8 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 5 d = 8 6 d = 8 7 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 5 d = 8 6 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 5 d = 8 1 d = 8 2 d = 8 3 d = 8 4 d = 8 1 d = 8 2 d = 8 3 d = 8 1 d = 8 2 d = 8 1 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 5 d = 9 6 d = 9 7 d = 9 8 d = 9 9 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 5 d = 9 6 d = 9 7 d = 9 8 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 5 d = 9 6 d = 9 7 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 5 d = 9 6 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 5 d = 9 1 d = 9 2 d = 9 3 d = 9 4 d = 9 1 d = 9 2 d = 9 3 d = 9 1 d = 9 2 d = 9 1 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 8 d = 1 9 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 8 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 8 d = 2 9 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 8 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 ...

4   Pass
a = double(magic(7)<6); [r1,r2,c1,c2] = biggest_box(a); sub = a(r1:r2,c1:c2); [m,n] = size(sub); len = 4; assert(isequal(sum(sub(:)),0)) assert(isequal(m,len)); assert(isequal(n,len));

d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 1 d = 3 2 d = 3 3 d = 3 1 d = 3 2 d = 3 1 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 1 d = 4 2 d = 4 3 d = 4 1 d = 4 2 d = 4 1 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 1 d = 5 2 d = 5 3 d = 5 1 d = 5 2 d = 5 1 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 7 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 1 d = 6 2 d = 6 3 d = 6 1 d = 6 2 d = 6 1 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 7 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 6 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 5 d = 7 1 d = 7 2 d = 7 3 d = 7 4 d = 7 1 d = 7 2 d = 7 3 d = 7 1 d = 7 2 d = 7 1 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 1 d = 3 2 d = 3 3 d = 3 1 d = 3 2 d = 3 1 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 1 d = 4 2 d = 4 3 d = 4 1 d = 4 2 d = 4 1 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 1 d = 5 2 d = 5 3 d = 5 1 d = 5 2 d = 5 1 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 7 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 6 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 5 d = 6 1 d = 6 2 d = 6 3 d = 6 4 d = 6 1 d = 6 2 d = 6 3 d = 6 1 d = 6 2 d = 6 1 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 7 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 6 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 5 d = 1 1 d = 1 2 d = 1 3 d = 1 4 d = 1 1 d = 1 2 d = 1 3 d = 1 1 d = 1 2 d = 1 1 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 7 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 6 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 5 d = 2 1 d = 2 2 d = 2 3 d = 2 4 d = 2 1 d = 2 2 d = 2 3 d = 2 1 d = 2 2 d = 2 1 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 7 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 6 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 5 d = 3 1 d = 3 2 d = 3 3 d = 3 4 d = 3 1 d = 3 2 d = 3 3 d = 3 1 d = 3 2 d = 3 1 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 7 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 6 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 5 d = 4 1 d = 4 2 d = 4 3 d = 4 4 d = 4 1 d = 4 2 d = 4 3 d = 4 1 d = 4 2 d = 4 1 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 7 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 6 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 5 d = 5 1 d = 5 2 d = 5 3 d = 5 4 d = 5 1 d = 5 2 ...