Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1902118

Submitted on 16 Aug 2019 by Andreas Neul
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

### Test Suite

Test Status Code Input and Output
1   Pass
x = [0 1 2 3 4]; assert(isequal(mono_increase(x),true));

l = 5 tf = logical 1 j = 2 j = 3 j = 4 j = 5

2   Pass
x = [0]; assert(isequal(mono_increase(x),true));

l = 1 tf = logical 1

3   Pass
x = [0 0 0 0 0]; assert(isequal(mono_increase(x),false));

l = 5 tf = logical 1 tf = logical 0 j = 2 tf = logical 0 j = 3 tf = logical 0 j = 4 tf = logical 0 j = 5

4   Pass
x = [0 1 2 3 -4]; assert(isequal(mono_increase(x),false));

l = 5 tf = logical 1 j = 2 j = 3 j = 4 tf = logical 0 j = 5

5   Pass
x = [-3 -4 2 3 4]; assert(isequal(mono_increase(x),false));

l = 5 tf = logical 1 tf = logical 0 j = 2 j = 3 j = 4 j = 5

6   Pass
x = 1:.1:10; assert(isequal(mono_increase(x),true));

l = 91 tf = logical 1 j = 2 j = 3 j = 4 j = 5 j = 6 j = 7 j = 8 j = 9 j = 10 j = 11 j = 12 j = 13 j = 14 j = 15 j = 16 j = 17 j = 18 j = 19 j = 20 j = 21 j = 22 j = 23 j = 24 j = 25 j = 26 j = 27 j = 28 j = 29 j = 30 j = 31 j = 32 j = 33 j = 34 j = 35 j = 36 j = 37 j = 38 j = 39 j = 40 j = 41 j = 42 j = 43 j = 44 j = 45 j = 46 j = 47 j = 48 j = 49 j = 50 j = 51 j = 52 j = 53 j = 54 j = 55 j = 56 j = 57 j = 58 j = 59 j = 60 j = 61 j = 62 j = 63 j = 64 j = 65 j = 66 j = 67 j = 68 j = 69 j = 70 j = 71 j = 72 j = 73 j = 74 j = 75 j = 76 j = 77 j = 78 j = 79 j = 80 j = 81 j = 82 j = 83 j = 84 j = 85 j = 86 j = 87 j = 88 j = 89 j = 90 j = 91

7   Pass
x = cumsum(rand(1,100)); x(5) = -1; assert(isequal(mono_increase(x),false));

l = 100 tf = logical 1 j = 2 j = 3 j = 4 tf = logical 0 j = 5 j = 6 j = 7 j = 8 j = 9 j = 10 j = 11 j = 12 j = 13 j = 14 j = 15 j = 16 j = 17 j = 18 j = 19 j = 20 j = 21 j = 22 j = 23 j = 24 j = 25 j = 26 j = 27 j = 28 j = 29 j = 30 j = 31 j = 32 j = 33 j = 34 j = 35 j = 36 j = 37 j = 38 j = 39 j = 40 j = 41 j = 42 j = 43 j = 44 j = 45 j = 46 j = 47 j = 48 j = 49 j = 50 j = 51 j = 52 j = 53 j = 54 j = 55 j = 56 j = 57 j = 58 j = 59 j = 60 j = 61 j = 62 j = 63 j = 64 j = 65 j = 66 j = 67 j = 68 j = 69 j = 70 j = 71 j = 72 j = 73 j = 74 j = 75 j = 76 j = 77 j = 78 j = 79 j = 80 j = 81 j = 82 j = 83 j = 84 j = 85 j = 86 j = 87 j = 88 j = 89 j = 90 j = 91 j = 92 j = 93 j = 94 j = 95 j = 96 j = 97 j = 98 j = 99 j = 100

8   Pass
x = cumsum(rand(1,50)); assert(isequal(mono_increase(x),true));

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