This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x=ones(4);
y_correct = [2,1,2,1
1,2,1,2
2,1,2,1
1,2,1,2];
assert(isequal(a_1_2_checkerboard_where_true(x),y_correct))
u =
2 1 2 1
1 2 1 2
2 1 2 1
1 2 1 2
ans =
[]
ans =
2 1 2 1
1 2 1 2
2 1 2 1
1 2 1 2
|
2 | Pass |
x = ones(3,2);
y_correct = [2,1;1,2;2,1];
assert(isequal(a_1_2_checkerboard_where_true(x),y_correct))
u =
2 1
1 2
2 1
ans =
[]
ans =
2 1
1 2
2 1
|
3 | Pass |
y_correct = 2;
assert(isequal(a_1_2_checkerboard_where_true(1),y_correct))
u =
2
ans =
[]
ans =
2
|
4 | Pass |
x = [...
0,1,0,1,0;
1,1,1,1,1;
0,1,0,1,0;
1,1,1,1,1;
0,1,0,1,0];
y_correct = [0,1,0,1,0;
1,2,1,2,1;
0,1,0,1,0;
1,2,1,2,1;
0,1,0,1,0];
assert(isequal(a_1_2_checkerboard_where_true(x),y_correct))
u =
2 1 2 1 2
1 2 1 2 1
2 1 2 1 2
1 2 1 2 1
2 1 2 1 2
ans =
[]
ans =
0 1 0 1 0
1 2 1 2 1
0 1 0 1 0
1 2 1 2 1
0 1 0 1 0
|
5 | Pass |
x = ones(5,5); x(2:3,2:3)=0;
y_correct = [2,1,2,1,2;
1,0,0,2,1;
2,0,0,1,2;
1,2,1,2,1;
2,1,2,1,2];
assert(isequal(a_1_2_checkerboard_where_true(x),y_correct))
u =
2 1 2 1 2
1 2 1 2 1
2 1 2 1 2
1 2 1 2 1
2 1 2 1 2
ans =
[]
ans =
2 1 2 1 2
1 0 0 2 1
2 0 0 1 2
1 2 1 2 1
2 1 2 1 2
|
6 | Pass |
x=[1,1,0,0,0,0,0,0,0,1;
1,0,1,0,0,1,1,0,1,1;
1,0,1,0,1,1,1,1,1,1;
0,0,1,0,0,1,1,1,1,1;
0,1,0,0,0,0,0,0,1,1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