Cody

# Problem 658. Find the biggest empty box

Solution 157029

Submitted on 2 Nov 2012 by J.R.! Menzinger
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));

f = 0 1 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));

f = 3 4 2 4 4 2 2 2 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));

f = 6 9 10 11 12 12 12 9 6 9 12 13 14 15 16 16 12 8 10 13 12 13 14 15 16 12 8 11 14 13 12 13 14 15 12 8 12 15 14 13 12 13 14 11 8 12 16 15 14 13 12 13 10 7 12 16 16 15 14 13 12 9 6 9 12 12 12 11 10 9 6 4 6 8 8 8 8 7 6 4 2

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));

f = 9 11 11 11 11 9 6 11 14 15 15 15 12 8 11 15 16 16 15 11 7 11 15 16 15 14 10 6 11 15 15 14 13 9 6 9 12 11 10 9 6 4 6 8 7 6 6 4 3