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 |
CN = 7;
Dim = 2;
Y= [1 1 0 0 0 0 0
0 0 1 1 0 0 0
0 0 0 0 1 1 0
1 0 0 0 0 0 1]
assert(isequal(MatrixProduction(CN,Dim),Y))
Y =
1 1 0 0 0 0 0
0 0 1 1 0 0 0
0 0 0 0 1 1 0
1 0 0 0 0 0 1
|
2 | Pass |
CN = 6;
Dim = 2;
Y= [1 1 0 0 0 0
0 0 1 1 0 0
0 0 0 0 1 1 ]
assert(isequal(MatrixProduction(CN,Dim),Y))
Y =
1 1 0 0 0 0
0 0 1 1 0 0
0 0 0 0 1 1
|
3 | Pass |
CN = 10;
Dim = 1;
Y= eye(10)
assert(isequal(MatrixProduction(CN,Dim),Y))
Y =
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 1
|
4 | Pass |
CN = 12;
Dim = 3;
Y= [ 1 1 1 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1]
assert(isequal(MatrixProduction(CN,Dim),Y))
Y =
1 1 1 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1
|
5 | Pass |
CN = 17;
Dim = 7;
Y= [1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 ];
assert(isequal(MatrixProduction(CN,Dim),Y))
|
6 | Pass |
CN = 20;
Dim = 10;
Y= [ones(1,10) zeros(1,10); zeros(1,10) ones(1,10)];
assert(isequal(MatrixProduction(CN,Dim),Y))
|
22970 Solvers
1399 Solvers
Project Euler: Problem 7, Nth prime
339 Solvers
We love vectorized solutions. Problem 1 : remove the row average.
377 Solvers
Is this triangle right-angled?
1916 Solvers