This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = [1 2 3 4 5];
n=2;
y_correct = [1 0 0 2 0 0 3 0 0 4 0 0 5 0 0];
assert(isequal(insert_zeros(x,n),y_correct))
ans =
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ans =
1 0 0 2 0 0 3 0 0 4 0 0 5 0 0
|
2 | Pass |
%%
x = [1 2 3 4 5];
n=1;
y_correct = [1 0 2 0 3 0 4 0 5 0 ];
assert(isequal(insert_zeros(x,n),y_correct))
ans =
0 0 0 0 0 0 0 0 0 0
ans =
1 0 2 0 3 0 4 0 5 0
|
3 | Pass |
%%
x = [1 2];
n=5;
y_correct = [1 0 0 0 0 0 2 0 0 0 0 0];
assert(isequal(insert_zeros(x,n),y_correct))
ans =
0 0 0 0 0 0 0 0 0 0 0 0
ans =
1 0 0 0 0 0 2 0 0 0 0 0
|
Return the largest number that is adjacent to a zero
3749 Solvers
594 Solvers
Determine if a Given Number is a Triangle Number
322 Solvers
15295 Solvers
1143 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!