Skip to content

minSorted

minSorted(x): number

Defined in: src/min_sorted.js:12

The minimum is the lowest number in the array. With a sorted array, the first element in the array is always the smallest, so this calculation can be done in one step, or constant time.

number[]

input

number

minimum value

if x is empty

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