Population Variance
MediumStatisticsMathArray
Description
Given an array of numbers nums, return the population variance using the n denominator, rounded to 4 decimal places.
Examples
Input:
nums = [2,4,6,8]Output:
5Explanation:
Summing squared deviations from the mean and dividing by n gives 5.
Input:
nums = [1,2,3,4,5]Output:
2Explanation:
Summing squared deviations from the mean and dividing by n gives 2.
Input:
nums = [7,7,7]Output:
0Explanation:
Summing squared deviations from the mean and dividing by n gives 0.
Constraints
- •
1 ≤ nums.length ≤ 10⁴