Cody

Problem 2476. Max Change in Consecutive Elements

Solution 2078580

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

a = 9 -7 -3 2 2 -4 -8 17 -8 y = 8 out = 8 9

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

a = 5 -13 16 22 y = 4 out = 4 5

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

a = 1 1 -3 5 1 1 1 1 1 y = 4 out = 4 5

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

a = 9 90 900 9000 90000 900000 9000000 y = 7 out = 7 8

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

a = 20 -18 15 -12 8 -5 3 -2 1 y = 1 out = 1 2

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

a = Columns 1 through 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 18 through 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 35 through 51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 52 through 68 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 69 through 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 86 through 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 103 through 119 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 120 through 136 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 137 through 153 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 154 through 170 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 171 through 187 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 188 through 204 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 205 through 221 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 222 through 238 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 239 through 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 256 through 272 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 273 through 289 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 290 through 306 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 307 through 323 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 324 through 340 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 341 through 357 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 358 through 374 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 375 through 391 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 392 through 408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 409 through 425 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 426 through 442 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 443 through 459 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 460 through 476 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 477 through 493 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 494 through 510 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 511 through 527 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 528 through 544 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 545 through 561 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 562 through 578 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 579 through 595 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 596 through 612 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 613 through 629 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 630 through 646 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 647 through 663 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 664 through 680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 681 through 697 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 698 through 714 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 715 through 731 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 732 through 748 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 749 through 765 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 766 through 782 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 783 through 799 0 0 0 0 -0.5000 -0.5000 1.0000 0 0 0 0 0 0 0 0 0 0 Columns 800 through 816 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 817 through 833 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 834 through 850 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 851 through 867 0 0 0...