Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = 1;
y_correct = 1;
y = only_once(x);
assert(isequal(y,y_correct))
ans =
1
|
2 | Pass |
%%
x = [1 0 0 1];
y_correct = [1 0 0 1];
y = only_once(x);
assert(isequal(y,y_correct))
ans =
1 0 0 1
|
3 | Pass |
%%
x = [0 0 1 1 0;0 1 1 0 0;0 0 0 0 1];
y_correct = [0 0 1 1 0;0 1 0 0 0;0 0 0 0 1];
y = only_once(x);
assert(isequal(y,y_correct))
ans =
0 0 1 1 0
0 1 0 0 0
0 0 0 0 1
|
4 | Pass |
%%
x = randi(2,10,10)-1;
y = only_once(x);
assert(all(sum(y,1)==any(y,1)))
ans =
0 0 0 1 0 1 1 1 0 1
0 0 1 0 0 0 0 0 1 0
1 1 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
|
5 | Pass |
%%
x = randi(2,1,100)-1;
y = only_once(x);
assert(all(sum(y,1)==any(y,1)))
ans =
Columns 1 through 16
1 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0
Columns 17 through 32
1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 0
Columns 33 through 48
1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1
Columns 49 through 64
0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1
Columns 65 through 80
1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 0
Columns 81 through 96
1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1
Columns 97 through 100
1 1 1 1
|
6 | Pass |
%%
x = randi(2,10,1)-1;
y = only_once(x);
assert(all(sum(y,1)==any(y,1)))
ans =
1
0
0
0
0
0
0
0
0
0
|
1514 Solvers
61 Solvers
213 Solvers
377 Solvers
Matrix rotation as per given angle
76 Solvers