Cody

# Problem 658. Find the biggest empty box

Solution 1932161

Submitted on 12 Sep 2019 by Binh Nguyen Cong
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));

r = 2 c = 1 varargout = 1×4 cell array {[2]} {[2]} {[1]} {[1]} r = [] c = [] r = [] c = []

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

r = 2 c = 1 varargout = 1×4 cell array {[2]} {[2]} {[1]} {[1]} r = 2 c = 1 varargout = 1×4 cell array {[2]} {[3]} {[1]} {[2]} r = [] c = [] r = [] c = []

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

r = 2 c = 1 varargout = 1×4 cell array {[2]} {[2]} {[1]} {[1]} r = 3 c = 1 varargout = 1×4 cell array {[3]} {[4]} {[1]} {[2]} r = 4 c = 1 varargout = 1×4 cell array {[4]} {[6]} {[1]} {[3]} r = 5 c = 1 varargout = 1×4 cell array {[5]} {[8]} {[1]} {[4]} r = 0×1 empty double column vector c = 0×1 empty double column vector r = 0×1 empty double column vector c = 0×1 empty double column vector r = 0×1 empty double column vector c = 0×1 empty double column vector r = 0×1 empty double column vector c = 0×1 empty double column vector r = [] c = [] r = [] c = []

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

r = 1 c = 1 varargout = 1×4 cell array {[1]} {[1]} {[1]} {[1]} r = 1 c = 1 varargout = 1×4 cell array {[1]} {[2]} {[1]} {[2]} r = 1 c = 1 varargout = 1×4 cell array {[1]} {[3]} {[1]} {[3]} r = 2 c = 2 varargout = 1×4 cell array {[2]} {[5]} {[2]} {[5]} r = 0×1 empty double column vector c = 0×1 empty double column vector r = 0×1 empty double column vector c = 0×1 empty double column vector r = [] c = [] r = [] c = []