Given an array of integers, determine the span of the sequence. The span is defined as the absolute difference between the largest value and the smallest value present within the array.
Explanation: The maximum value is 19 and the minimum value is 3. The span is 19 - 3 = 16.
Explanation: The maximum value is 7 and the minimum value is 7. The span is 7 - 7 = 0.
Explanation: The maximum value is 10 and the minimum value is -5. The span is 10 - (-5) = 15.
Iterating arrays and tracking min/max
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak