about | help | code help+videos | done | prefs |
Write a method that returns the greatest difference between any two values in the array 'nums'. For example, in the array {5,2,16,12,9}, the greatest difference is 14 since 16-2=14 and there is no greater difference between pairs of numbers in the array. You may assume that the array contains at least one value and therefor has a length of 1 or more. I highly recommend searching for the least and greatest values in the array. To do that you will want to start with something like this: int least = nums[0]; int greatest = nums[0]; This is only possible because we are told that the array will contain at least one value. todays_2021_10_29_APSL_diff([53, 325, 436, 66, 685, 12, 5754, 65, 67, 76, 54423, 235, 7, 65, 658, 5634, 234, 643, 6, 7, 523, 467, 23, 253, 757, 767, 325, 5457]) → 54417 todays_2021_10_29_APSL_diff([15, 20, 530, 42, 532, -530, 40, -440, -400, 200, 202]) → 1062 todays_2021_10_29_APSL_diff([124, 423, 654, 752, 532, 23, 463, 54, 874, 352, 343]) → 851 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 240
Copyright Nick Parlante 2017 - privacy