Cody

Problem 42845. generate number in particular way

Solution 1932175

Submitted on 12 Sep 2019
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
a = [1 5 2 7]; m = 10; y_correct = [1 2 2 2 2 2 3 3 4 4]; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 y = 1 2 2 2 2 2 y = 1 2 2 2 2 2 3 3 y = 1 2 2 2 2 2 3 3 4 4 4 4 4 4 4

Assertion failed.

2   Fail
a = [2 3 2 7 4 6]; m = 22; y_correct = [1 1 2 2 2 3 3 4 4 4 4 4 4 4 5 5 5 5 6 6 6 6]; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 1 y = 1 1 2 2 2 y = 1 1 2 2 2 3 3 y = 1 1 2 2 2 3 3 4 4 4 4 4 4 4 y = 1 1 2 2 2 3 3 4 4 4 4 4 4 4 5 5 5 5 y = 1 1 2 2 2 3 3 4 4 4 4 4 4 4 5 5 5 5 6 6 6 6 6 6

Assertion failed.

3   Fail
a = ones(1,100); m = 42; y_correct = 1:42; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 y = 1 2 y = 1 2 3 y = 1 2 3 4 y = 1 2 3 4 5 y = 1 2 3 4 5 6 y = 1 2 3 4 5 6 7 y = 1 2 3 4 5 6 7 8 y = 1 2 3 4 5 6 7 8 9 y = 1 2 3 4 5 6 7 8 9 10 y = 1 2 3 4 5 6 7 8 9 10 11 y = 1 2 3 4 5 6 7 8 9 10 11 12 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Column 31 31 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 32 31 32 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 33 31 32 33 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 34 31 32 33 34 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 35 31 32 33 34 35 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 36 31 32 33 34 35 36 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 37 31 32 33 34 35 36 37 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 38 31 32 33 34 35 36 37 38 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 39 31 32 33 34 35 36 37 38 39 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 40 31 32 33 34 35 36 37 38 39 40 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 41 31 32 33 34 35 36 37 38 39 40 41 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 42 31 32 33 34 35 36 37 38 39 40 41 42 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 43 31 32 33 34 35 36 37 38 39 40 41 42 43 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 44 31 32 33 34 35 36 37 38 39 40 41 42 43 44 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 46 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 47 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 48 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 49 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 50 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 51 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 52 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ...

Assertion failed.

4   Pass
a = [3 1 2 6 1]; m = 13; y_correct = [1 1 1 2 3 3 4 4 4 4 4 4 5]; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 1 1 y = 1 1 1 2 y = 1 1 1 2 3 3 y = 1 1 1 2 3 3 4 4 4 4 4 4 y = 1 1 1 2 3 3 4 4 4 4 4 4 5

5   Fail
a = 1:10; m = 20; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6]; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 y = 1 2 2 y = 1 2 2 3 3 3 y = 1 2 2 3 3 3 4 4 4 4 y = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 y = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 y = 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 y = 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 y = 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 y = 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 55 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

Assertion failed.

6   Fail
a = [3 1 4 1 5 2]; m = 13; y_correct = [1 1 1 2 3 3 3 3 4 5 5 5 5]; assert(isequal(your_fcn_name(a,m),y_correct))

y = 1 1 1 y = 1 1 1 2 y = 1 1 1 2 3 3 3 3 y = 1 1 1 2 3 3 3 3 4 y = 1 1 1 2 3 3 3 3 4 5 5 5 5 5 y = 1 1 1 2 3 3 3 3 4 5 5 5 5 5 6 6

Assertion failed.

Suggested Problems

More from this Author3

Community Treasure Hunt

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

Start Hunting!