Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 1287387

Submitted on 15 Oct 2017 by Alexis Marchesi
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 = [0 1 2 3 4]; assert(isequal(mono_increase(x),true));

k = 1 k = 2 k = 3 k = 4 k = 5 tf = logical 1

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

k = 1 tf = logical 1

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

k = 1 tf = logical 0

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

k = 1 k = 2 k = 3 k = 4 tf = logical 0

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

k = 1 k = 2 k = 3 k = 4 tf = logical 0

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

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

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

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

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

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