Given an array of integers, compute the range span of the sequence. The range span is defined as the mathematical difference between the maximum element and the minimum element present in the array. If the array contains only one element, the range span is 0.
Explanation: The maximum element is 21 and the minimum element is 2. The range span is 21 - 2 = 19.
Explanation: The maximum element is 0 and the minimum element is -10. The range span is 0 - (-10) = 10.
Iterating arrays and tracking min/max
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak