Range of Data
EasyStatisticsArray
Description
Given an array of numbers nums, return the range, defined as the maximum value minus the minimum value.
Examples
Input:
nums = [3,1,4,1,5]Output:
4Explanation:
Subtracting the smallest value from the largest spans 4.
Input:
nums = [10,10]Output:
0Explanation:
Subtracting the smallest value from the largest spans 0.
Input:
nums = [-5,0,7]Output:
12Explanation:
Subtracting the smallest value from the largest spans 12.
Constraints
- •
1 ≤ nums.length ≤ 10⁴