Cody

Solution 2263515

Submitted on 8 May 2020
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   Fail
x = [1 10 3 0 2 4 0 -8 9 1]; y_correct = [8 9]; assert(isequal(maxChange(x),y_correct))

Assertion failed.

2   Fail
x = [10 15 2 18 40]; y_correct = [4 5]; assert(isequal(maxChange(x),y_correct))

Assertion failed.

3   Fail
x = 1:10; x(4) = 0; y_correct = [4 5]; assert(isequal(maxChange(x),y_correct))

Assertion failed.

4   Fail
x = [1 10 100 1e3 1e4 1e5 1e6 1e7]; y_correct = [7 8]; assert(isequal(maxChange(x),y_correct))

Assertion failed.

5   Fail
x = [-10 10 -8 7 -5 3 -2 1 -1 0]; y_correct = [1 2]; assert(isequal(maxChange(x),y_correct))

Assertion failed.

6   Fail
x = ones(1,1e6); x(789) = 0; x(788) = 0.5; y_correct = [789 790]; assert(isequal(maxChange(x),y_correct))

Requested 1000000x1000000 (7450.6GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. Error in maxChange (line 2) ind = max(abs(x-x'),[],'all','linear'); Error in Test6 (line 4) assert(isequal(maxChange(x),y_correct))