Cody

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

Solution 2786773

Submitted on 5 Aug 2020
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   Fail
x = 2; y_correct = [1 2 2]; assert(isequal(your_fcn_name(x),y_correct))

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

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

Error in solution: Line: 4 Column: 31 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.