@univerjscorefunctionsBinsearchfirstgreaterthantarget

@univerjs/core v0.5.4


Function: binSearchFirstGreaterThanTarget()

function binSearchFirstGreaterThanTarget(arr, target): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/array-search.ts:105

Return the index of the last index in an ascending array which value is just greater than the target. If there is no value greater than the target, return arr.length - 1.

Alternatively, you can consider inserting a number to ensure the array remains sorted, and return the position for insertion.

Parameters

ParameterType
arrnumber[]
targetnumber

Returns

number