Tricky solution!
How do I view solutions? Everything is locked. It says I may solve ANOTHER problem to unlock, but I keep solving and everything is still locked. Not terribly helpful.
You have to solve additional problems and then come back to look at the solutions here.
Nice and simple "math" solution!
if i can do that i dont need to view this solution,what a stupid rule
so stupid rule!!
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)))
ans =
[]
|
2 | Pass |
%%
n = 4;
a = [1 0 1 0;
0 1 0 1;
1 0 1 0;
0 1 0 1];
assert(isequal(a,checkerboard(n)))
ans =
[]
|
3 | Pass |
%%
n = 7;
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 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)))
ans =
[]
|
17214 Solvers
Get the length of a given vector
3561 Solvers
725 Solvers
Set the array elements whose value is 13 to 0
936 Solvers
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
511 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!