Deviopath › TypeScript

Stats as a Labeled Tuple

Medium · Arrays & Tuples

Labeled tuples give names to positions: [min: number, max: number, mean: number].

Write stats(nums: number[]): [min: number, max: number, mean: number] | null that returns the smallest value, the largest value and the average (rounded to 2 decimals). Return null for an empty array.

Next: Sorted Frequency Table