Cody

Solution 2137222

Submitted on 22 Feb 2020 by Ikram Belkhiri
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));

s = 2 r2 = 2 c2 = 2 r2 = 1 c2 = 1 r2 = 1 c2 = 2

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

s = 3 r2 = 3 c2 = 3 r2 = 2 c2 = 2 r2 = 2 c2 = 3

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

s = 9 r2 = 9 c2 = 9 r2 = 8 c2 = 8 r2 = 8 c2 = 9 r2 = 9 c2 = 8 r2 = 9 c2 = 9 r2 = 7 c2 = 7 r2 = 7 c2 = 8 r2 = 7 c2 = 9 r2 = 8 c2 = 7 r2 = 8 c2 = 8 r2 = 8 c2 = 9 r2 = 9 c2 = 7 r2 = 9 c2 = 8 r2 = 9 c2 = 9 r2 = 6 c2 = 6 r2 = 6 c2 = 7 r2 = 6 c2 = 8 r2 = 6 c2 = 9 r2 = 7 c2 = 6 r2 = 7 c2 = 7 r2 = 7 c2 = 8 r2 = 7 c2 = 9 r2 = 8 c2 = 6 r2 = 8 c2 = 7 r2 = 8 c2 = 8 r2 = 8 c2 = 9 r2 = 9 c2 = 6 r2 = 9 c2 = 7 r2 = 9 c2 = 8 r2 = 9 c2 = 9 r2 = 5 c2 = 5 r2 = 5 c2 = 6 r2 = 5 c2 = 7 r2 = 5 c2 = 8 r2 = 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