Cody

Problem 3076. Create a vector

Solution 2817634

Submitted on 11 Aug 2020 by Yin-Lung Wong
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
n = 10; y_correct = (0:2:n); assert(isequal(zeroToNby2(n),y_correct))

y = [] y = 0 y = 0 2 y = 0 2 4 y = 0 2 4 6 y = 0 2 4 6 8 y = 0 2 4 6 8 10

2   Pass
n = 102; y_correct = (0:2:n); assert(isequal(zeroToNby2(n),y_correct))

y = [] y = 0 y = 0 2 y = 0 2 4 y = 0 2 4 6 y = 0 2 4 6 8 y = 0 2 4 6 8 10 y = 0 2 4 6 8 10 12 y = 0 2 4 6 8 10 12 14 y = 0 2 4 6 8 10 12 14 16 y = 0 2 4 6 8 10 12 14 16 18 y = 0 2 4 6 8 10 12 14 16 18 20 y = 0 2 4 6 8 10 12 14 16 18 20 22 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Column 31 60 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 32 60 62 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 33 60 62 64 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 34 60 62 64 66 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 35 60 62 64 66 68 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 36 60 62 64 66 68 70 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 37 60 62 64 66 68 70 72 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 38 60 62 64 66 68 70 72 74 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 39 60 62 64 66 68 70 72 74 76 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 40 60 62 64 66 68 70 72 74 76 78 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 41 60 62 64 66 68 70 72 74 76 78 80 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 42 60 62 64 66 68 70 72 74 76 78 80 82 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 43 60 62 64 66 68 70 72 74 76 78 80 82 84 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 44 60 62 64 66 68 70 72 74 76 78 80 82 84 86 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 45 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 46 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 47 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 48 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 49 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 50 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 51 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 52 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102

3   Pass
n = 73; y_correct = (0:2:n); assert(isequal(zeroToNby2(n),y_correct))

y = [] y = 0 y = 0 2 y = 0 2 4 y = 0 2 4 6 y = 0 2 4 6 8 y = 0 2 4 6 8 10 y = 0 2 4 6 8 10 12 y = 0 2 4 6 8 10 12 14 y = 0 2 4 6 8 10 12 14 16 y = 0 2 4 6 8 10 12 14 16 18 y = 0 2 4 6 8 10 12 14 16 18 20 y = 0 2 4 6 8 10 12 14 16 18 20 22 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 y = 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Column 31 60 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 32 60 62 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 33 60 62 64 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 34 60 62 64 66 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 35 60 62 64 66 68 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 36 60 62 64 66 68 70 y = Columns 1 through 30 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 31 through 37 60 62 64 66 68 70 72

Suggested Problems

Community Treasure Hunt

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

Start Hunting!