Ad
  • Default User Avatar

    To help improve on this example, it seems that the following test would also pass:

    Test.expect (largestDifference([9,4,1,10,3,4,0,-1,-2]) == 4); // data[1] <= data[5), so 5 - 1 = 4
    Test.expect (largestDifference([3,2,1]) == 0); // never finds data[n<i] <= data[i]
    
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution