Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 909264

Submitted on 15 Jun 2016 by Matthew Stuckey
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));

count = 1 count = 2 count = 3 count = 4 tf = 1

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

tf = 1

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

tf = 0

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

count = 1 count = 2 count = 3 tf = 0

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

tf = 0

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

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

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

count = 1 count = 2 count = 3 tf = 0

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

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