Test  Status  Code Input and Output 

1  Fail 
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));
ans =
1 0
0 0
r1 =
1
r2 =
1
c1 =
1
c2 =
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));
ans =
1 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
1 0 0
0 0 0
0 0 0
r1 =
1
r2 =
2
c1 =
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));
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 1
ans =
1 0 0
0 1 0
0 0 1
ans =
0 0 0
1 0 0
0 1 0
ans =
0 0 0
0 0 0
1 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 1 0
0 0 1
0 0 0
ans =
1 0 0
0 1 0
0 0 1
ans =
0 0 0
1 0 0
0 1 0
ans =
0 0 0
0 0 0
1 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 1
0 0 0
0 0 0
ans =
0 1 0
0 0 1
0 0 0
ans =
1 0 0
0 1 0
0 0 1
ans =
0 0 0
1 0 0
0 1 0
ans =
0 0 0
0 0 0
1 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 1
0 0 0
0 0 0
ans =
0 1 0
0 0 1
0 0 0
ans =
1 0 0
0 1 0
0 0 1
ans =
0 0 0
1 0 0
0 1 0
ans =
0 0 0
0 0 0
1 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 1
0 0 0
0 0 0
ans =
0 1 0
0 0 1
0 0 0
ans =
1 0 0
0 1 0
0 0 1
ans =
0 0 0
1 0 0
0 1 0
ans =
0 0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 1
0 0 0 0
0 0 0 0
ans =
0 1 0 0
0 0 1 0
0 0 0 1
0 0 0 0
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
ans =
0 0 0 0
1 0 0 0
0 1 0 0
0 0 1 0
ans =
0 0 0 0
0 0 0 0
1 0 0 0
0 1 0 0
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 0 1 0
0 0 0 1
0 0 0 0
0 0 0 0
ans =
0 1 0 0
0 0 1 0
0 0 0 1
0 0 0 0
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
ans =
0 0 0 0
1 0 0 0
0 1 0 0
0 0 1 0
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 0 0 1
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 0 1 0
0 0 0 1
0 0 0 0
0 0 0 0
ans =
0 1 0 0
0 0 1 0
0 0 0 1
0 0 0 0
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
ans =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
ans =
0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
ans =
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
ans =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 ...

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));
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 1
0 0
ans =
1 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
1 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 1
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 1
ans =
0 1
1 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 0
ans =
0 0
0 1
ans =
0 1
1 0
ans =
1 0
0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 1
0 0 0
0 0 0
ans =
0 1 0
0 0 0
0 0 0
ans =
1 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
1 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
1 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 1
ans =
1 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 1
ans =
0 0 0
0 0 1
0 1 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 0
ans =
0 0 0
0 0 0
0 0 1
ans =
0 0 0
0 0 1
0 1 0
ans =
0 0 1
0 1 0
1 0 0
ans =
0 0 0 1
0 0 0 0
0 0 0 0
1 0 0 0
ans =
0 0 1 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
0 1 0 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
ans =
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0 0 0
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 1 0
ans =
0 0 0 0 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 1 0
ans =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 1 0
0 0 0 1 0 0
ans =
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 0 0
0 0 0 0 0 0 1
0 0 0 0 0 1 0
0 0 0 0 1 0 0
r1 =
2
r2 =
5
c1 =
2
c2 =
5

Project Euler: Problem 3, Largest prime factor
296 Solvers
Cell Counting: How Many Draws?
430 Solvers
200 Solvers
294 Solvers
735 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!