This solution is outdated. To rescore this solution, sign in.
Why is this solution getting the wrong values on the second solution set yet when I input it into MatLab to test it they are correct?
With an even-sized array, when you go from row 1 to row 2, the sequence has two zeros in a row instead of alternating zeros and ones.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
n = 5;
a = [1 0 1 0 1;
0 1 0 1 0;
1 0 1 0 1;
0 1 0 1 0;
1 0 1 0 1];
assert(isequal(a,checkerboard(n)))
a =
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
|
2 | Fail |
%%
n = 4;
a = [1 0 1 0;
0 1 0 1;
1 0 1 0;
0 1 0 1];
assert(isequal(a,checkerboard(n)))
Error: Assertion failed.
|
381 Solvers
Create an index-powered vector
353 Solvers
What is Sum Of all elements of Matrix
292 Solvers
327 Solvers
439 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!