Get the geometric mean of an array of numbers.
number
Time complexity: O(n)
Space complexity: O(1)
The array to calculate the mean of
The geometric mean of the array
Math
const array = [1, 2, 3, 4];geometricMean(array); // 24 ** (1 / 4) Copy
const array = [1, 2, 3, 4];geometricMean(array); // 24 ** (1 / 4)
Get the geometric mean of an array of
number
s.Time complexity: O(n)
Space complexity: O(1)