Cody

Problem 1035. Generate a vector like 1,2,2,3,3,3,4,4,4,4

Solution 1940293

Submitted on 17 Sep 2019 by Marta Ranzini
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 2; y_correct = [1 2 2]; assert(isequal(your_fcn_name(x),y_correct))

x = 1 x = 2 2

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5 x = 6 6 6 6 6 6 x = 7 7 7 7 7 7 7 x = 8 8 8 8 8 8 8 8 x = 9 9 9 9 9 9 9 9 9 x = 10 10 10 10 10 10 10 10 10 10

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5 x = 6 6 6 6 6 6 x = 7 7 7 7 7 7 7 x = 8 8 8 8 8 8 8 8 x = 9 9 9 9 9 9 9 9 9 x = 10 10 10 10 10 10 10 10 10 10 x = 11 11 11 11 11 11 11 11 11 11 11 x = 12 12 12 12 12 12 12 12 12 12 12 12

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5 x = 6 6 6 6 6 6 x = 7 7 7 7 7 7 7 x = 8 8 8 8 8 8 8 8 x = 9 9 9 9 9 9 9 9 9

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5 x = 6 6 6 6 6 6 x = 7 7 7 7 7 7 7

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))

x = 1 x = 2 2 x = 3 3 3 x = 4 4 4 4 x = 5 5 5 5 5 x = 6 6 6 6 6 6 x = 7 7 7 7 7 7 7 x = 8 8 8 8 8 8 8 8 x = 9 9 9 9 9 9 9 9 9 x = 10 10 10 10 10 10 10 10 10 10 x = 11 11 11 11 11 11 11 11 11 11 11 x = 12 12 12 12 12 12 12 12 12 12 12 12 x = 13 13 13 13 13 13 13 13 13 13 13 13 13 x = 14 14 14 14 14 14 14 14 14 14 14 14 14 14 x = 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15