Skip to main content
Module

x/statistics/mod.ts>maxSorted

Deno basic statistics module.
Latest
function maxSorted
import { maxSorted } from "https://deno.land/x/statistics@v0.1.1/mod.ts";

The maximum is the highest number in the sorted array. With a sorted array, the last element in the array is always the largest, so this calculation can be done in one step, or constant time.

Examples

maxSorted([-100, -10, 1, 2, 5]); // => 5

Parameters

x: number[]

input

Returns

number

maximum value