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.
Parameters
Section titled “Parameters”number[]
input
Returns
Section titled “Returns”number
minimum value
Throws
Section titled “Throws”if x is empty
Example
Section titled “Example”minSorted([-100, -10, 1, 2, 5]); // => -100