Cody

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

Solution 3383578

Submitted on 26 Oct 2020 by Hossein Kalhori
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))

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 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))

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans = 1 2 2 3 3 3 4 4 rep = 2 ans = 1 2 2 3 3 3 4 4 4 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 rep = 4 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 rep = 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))

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans =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 6 6 6 6 7 7 7 7 7 7 7 8 rep = 1 ans = 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 rep = 2 ans = Columns 1 through 30 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 Column 31 8 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 32 8 8 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 33 8 8 8 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 34 8 8 8 8 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 35 8 8 8 8 8 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 36 8 8 8 8 8 8 rep = 8 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 37 8 8 8 8 8 8 9 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 38 8 8 8 8 8 8 9 9 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 39 8 8 8 8 8 8 9 9 9 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 40 8 8 8 8 8 8 9 9 9 9 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 41 8 8 8 8 8 8 9 9 9 9 9 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 42 8 8 8 8 8 8 9 9 9 9 9 9 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 43 8 8 8 8 8 8 9 9 9 9 9 9 9 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 44 8 8 8 8 8 8 9 9 9 9 9 9 9 9 rep = 8 ans = Columns 1 through 30 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 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 rep = 9 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 46 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 47 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 48 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 49 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 50 8 8 8 ...

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

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans = 1 2 2 3 3 3 4 4 rep = 2 ans = 1 2 2 3 3 3 4 4 4 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 rep = 4 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 rep = 5 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 rep = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 rep = 6 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 rep = 3 ans = 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 rep = 4 ans = 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 rep = 5 ans = 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 rep = 6 ans = 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 rep = 7 rep = 0 ans = 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 rep = 1 ans = 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 rep = 2 ans = Columns 1 through 30 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 Column 31 8 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 32 8 8 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 33 8 8 8 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 34 8 8 8 8 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 35 8 8 8 8 8 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 36 8 8 8 8 8 8 rep = 8 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 37 8 8 8 8 8 8 9 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 38 8 8 8 8 8 8 9 9 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 39 8 8 8 8 8 8 9 9 9 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 40 8 8 8 8 8 8 9 9 9 9 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 41 8 8 8 8 8 8 9 9 9 9 9 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 42 8 8 8 8 8 8 9 9 9 9 9 9 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 43 8 8 8 8 8 8 9 9 9 9 9 9 9 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 44 8 8 8 8 8 8 9 9 9 9 9 9 9 9 rep = 8 ans = Columns 1 through 30 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 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 rep = 9 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 46 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 47 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 48 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 49 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 50 8 8 8 ...

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

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans = 1 2 2 3 3 3 4 4 rep = 2 ans = 1 2 2 3 3 3 4 4 4 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 rep = 4 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 rep = 5 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 rep = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 rep = 6 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 rep = 3 ans = 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 rep = 4 ans = 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 rep = 5 ans = 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 rep = 6 ans = 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 rep = 7 rep = 0 ans = 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 rep = 1 ans = 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 rep = 2 ans = Columns 1 through 30 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 Column 31 8 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 32 8 8 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 33 8 8 8 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 34 8 8 8 8 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 35 8 8 8 8 8 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 36 8 8 8 8 8 8 rep = 8 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 37 8 8 8 8 8 8 9 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 38 8 8 8 8 8 8 9 9 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 39 8 8 8 8 8 8 9 9 9 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 40 8 8 8 8 8 8 9 9 9 9 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 41 8 8 8 8 8 8 9 9 9 9 9 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 42 8 8 8 8 8 8 9 9 9 9 9 9 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 43 8 8 8 8 8 8 9 9 9 9 9 9 9 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 44 8 8 8 8 8 8 9 9 9 9 9 9 9 9 rep = 8 ans = Columns 1 through 30 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 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 rep = 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))

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans = 1 2 2 3 3 3 4 4 rep = 2 ans = 1 2 2 3 3 3 4 4 4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 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))

rep = 0 ans = 1 rep = 1 rep = 0 ans = 1 2 rep = 1 ans = 1 2 2 rep = 2 rep = 0 ans = 1 2 2 3 rep = 1 ans = 1 2 2 3 3 rep = 2 ans = 1 2 2 3 3 3 rep = 3 rep = 0 ans = 1 2 2 3 3 3 4 rep = 1 ans = 1 2 2 3 3 3 4 4 rep = 2 ans = 1 2 2 3 3 3 4 4 4 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 rep = 4 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 rep = 5 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 rep = 3 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 rep = 4 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 rep = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 rep = 6 rep = 0 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 rep = 1 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 rep = 2 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 rep = 3 ans = 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 rep = 4 ans = 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 rep = 5 ans = 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 rep = 6 ans = 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 rep = 7 rep = 0 ans = 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 rep = 1 ans = 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 rep = 2 ans = Columns 1 through 30 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 Column 31 8 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 32 8 8 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 33 8 8 8 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 34 8 8 8 8 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 35 8 8 8 8 8 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 36 8 8 8 8 8 8 rep = 8 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 37 8 8 8 8 8 8 9 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 38 8 8 8 8 8 8 9 9 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 39 8 8 8 8 8 8 9 9 9 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 40 8 8 8 8 8 8 9 9 9 9 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 41 8 8 8 8 8 8 9 9 9 9 9 rep = 5 ans = Columns 1 through 30 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 Columns 31 through 42 8 8 8 8 8 8 9 9 9 9 9 9 rep = 6 ans = Columns 1 through 30 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 Columns 31 through 43 8 8 8 8 8 8 9 9 9 9 9 9 9 rep = 7 ans = Columns 1 through 30 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 Columns 31 through 44 8 8 8 8 8 8 9 9 9 9 9 9 9 9 rep = 8 ans = Columns 1 through 30 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 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 rep = 9 rep = 0 ans = Columns 1 through 30 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 Columns 31 through 46 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 rep = 1 ans = Columns 1 through 30 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 Columns 31 through 47 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 rep = 2 ans = Columns 1 through 30 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 Columns 31 through 48 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 rep = 3 ans = Columns 1 through 30 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 Columns 31 through 49 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 rep = 4 ans = Columns 1 through 30 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 Columns 31 through 50 8 8 8 ...

Suggested Problems

More from this Author17

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!