Sample Standard Deviation
MediumStatisticsMathArrayTree
Description
Given an array of numbers nums (length ≥ 2), return the sample standard deviation (square root of the sample variance, n - 1 denominator), rounded to 4 decimal places.
Examples
Input:
nums = [2,4,6,8]Output:
2.582Explanation:
Taking the square root of the sample variance gives 2.582.
Input:
nums = [1,2,3,4,5]Output:
1.5811Explanation:
Taking the square root of the sample variance gives 1.5811.
Input:
nums = [3,3,5,5]Output:
1.1547Explanation:
Taking the square root of the sample variance gives 1.1547.
Constraints
- •
2 ≤ nums.length ≤ 10⁴