Additional test cases have been added.
This problem needs more tests. For instance, x = [1 10 3 0 2 4 0 8 -9 1] is a case with a non-positive difference, but a maximum change, which would make many solutions fail.
1311 Solvers
927 Solvers
654 Solvers
272 Solvers
124 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!