Cody

# Problem 10. Determine whether a vector is monotonically increasing

Solution 226467

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   Pass
%% x = [0]; assert(isequal(mono_increase(x),true));

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 10 0.7263 -0.1286 -3.3564 6.5905 -3.8945 0.4043 -0.0572 0.3840 0.0297 -0.6083 Columns 11 through 20 0.3029 -0.0442 0.2007 0.0631 0.0453 -0.4787 0.4037 -0.0246 -0.4925 -0.0436 Columns 21 through 30 0.3794 0.4614 -0.6194 0.2449 -0.3615 0.5275 -0.4962 0.2509 0.1931 0.1918 Columns 31 through 40 0.0684 -0.4121 -0.4086 0.0107 0.1082 0.5832 -0.5864 0.5600 -0.5708 0.6857 Columns 41 through 50 -0.5793 -0.1534 0.0545 0.3650 -0.1428 -0.1216 0.4792 -0.2456 -0.0355 0.3675 Columns 51 through 60 -0.6314 0.4714 -0.0035 -0.3733 0.1874 -0.4920 -0.0219 0.4768 0.2484 0.1548 Columns 61 through 70 -0.8041 0.4389 -0.0994 -0.4575 0.3252 -0.1749 0.6321 -0.4831 0.2173 -0.3629 Columns 71 through 80 0.4363 -0.3390 0.3911 0.0351 0.0589 -0.2976 -0.3667 0.1452 0.6844 -0.7610 Columns 81 through 90 0.6734 -0.2875 0.4578 -0.9180 0.3645 -0.3360 0.8552 -0.9573 0.7703 0.0424 Columns 91 through 98 0.0514 -0.7843 0.3153 -0.1399 0.5402 -0.3687 0.4792 -0.7288

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

Error: Assertion failed.