Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    You can always assume there is at least two value in the array, and that all values are integers.

    However, the sample tests still cointain this one:

    Test.assert_equals(most_difference([3]), 0)
    

    Furthermore, none of the examples show clearly if you want the see the biggest difference between neighbours (that's what all the sample tests suggest); or the biggest difference between any two elements in the array (that's what you expect). See:

    [-1, 4, 4, 3, 2] ==> 5
     '----' neighbours
    
    [69, -70, -35, 69] ==> 139
     '------' neighbours
    
    [-98, 81, 0] ==> 179
     '------' neighbours
    
    [948, -479, 708, -156] ==> 1427
     '--------' neighbours
    

    A simple example would make it clear, like:

    [2, 4, 4, 3, -1] ==> 5    # not neighbours anymore...