Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 226464

Submitted on 2 Apr 2013
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));

d = 0 0 0

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

Error: Assertion failed.

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

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

d = 0 0 -8

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

d = 7 -5 0

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

Error: Assertion failed.

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

d = Columns 1 through 9 -0.0289 -0.3360 -3.2856 6.4344 -2.4567 -0.8169 -0.0610 0.2662 -0.1743 Columns 10 through 18 0.2916 -0.1502 0.6121 -0.0313 -0.8677 0.6852 -0.4687 0.1537 0.1250 Columns 19 through 27 0.3949 -0.5250 0.5653 -0.6816 0.3996 -0.0348 -0.1272 0.1590 -0.0316 Columns 28 through 36 -0.4884 -0.0501 0.8711 -0.8280 -0.1385 0.5286 0.3207 -0.2127 -0.4787 Columns 37 through 45 0.1785 0.0918 0.5209 -0.8252 0.6991 -0.2108 -0.2685 -0.1853 0.2373 Columns 46 through 54 0.0538 -0.3614 0.4689 -0.3633 0.1584 0.1984 -0.3312 0.0386 0.3267 Columns 55 through 63 -0.3518 0.5591 0.1583 -0.2524 -0.3864 0.2402 -0.4763 0.7985 -0.0267 Columns 64 through 72 -0.0619 -0.5570 0.3336 -0.5718 0.4027 -0.1125 -0.1512 0.0173 0.2441 Columns 73 through 81 -0.3287 0.5043 -0.1276 0.2250 0.0039 -0.0614 -0.6049 0.0352 0.2508 Columns 82 through 90 0.2113 0.1236 -0.2468 0.4124 -0.1016 0.2503 -0.4373 -0.2062 -0.2195 Columns 91 through 98 0.5053 0.1678 -0.3553 -0.3326 0.1756 -0.1128 0.1273 0.1591

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

Error: Assertion failed.