This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 2;
y_correct = [1 2 2];
assert(isequal(your_fcn_name(x),y_correct))
|
2 | Pass |
x = 5;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5];
assert(isequal(your_fcn_name(x),y_correct))
|
3 | Pass |
x = 10;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ...
6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ...
9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10];
assert(isequal(your_fcn_name(x),y_correct))
|
4 | Pass |
x = 12;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ...
6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ...
9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 ...
11 11 11 11 11 11 11 11 11 11 11 ...
12 12 12 12 12 12 12 12 12 12 12 12];
assert(isequal(your_fcn_name(x),y_correct))
|
5 | Pass |
x = 9;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ...
6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ...
9 9 9 9 9 9 9 9 9];
assert(isequal(your_fcn_name(x),y_correct))
|
6 | Pass |
x = 7;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ...
6 6 6 6 6 6 7 7 7 7 7 7 7];
assert(isequal(your_fcn_name(x),y_correct))
|
7 | Pass |
x = 15;
y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ...
6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ...
9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 ...
11 11 11 11 11 11 11 11 11 11 11 ...
12 12 12 12 12 12 12 12 12 12 12 12 ...
13 13 13 13 13 13 13 13 13 13 13 13 13 ...
14 14 14 14 14 14 14 14 14 14 14 14 14 14 ...
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15];
assert(isequal(your_fcn_name(x),y_correct))
|
686 Solvers
436 Solvers
216 Solvers
56 Solvers
Sum of elements of a vector (★★★)
47 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!