Sample Mean
EasyStatisticsMathArray
Description
Given an array of numbers nums, return the arithmetic mean (average), rounded to 4 decimal places.
Examples
Input:
nums = [1,2,3,4]Output:
2.5Explanation:
Averaging the 4 values and rounding to four decimals gives 2.5.
Input:
nums = [10,20,30]Output:
20Explanation:
Averaging the 3 values and rounding to four decimals gives 20.
Input:
nums = [5]Output:
5Explanation:
Averaging the 1 values and rounding to four decimals gives 5.
Constraints
- •
1 ≤ nums.length ≤ 10⁴