@jiminp/tooltool
    Preparing search index...

    Variable bisectConst

    bisect: (sorted_arr: (number | bigint)[], target: number) => number = bisectRight

    Alias for bisectRight.

    Type Declaration

      • (sorted_arr: (number | bigint)[], target: number): number
      • Finds the rightmost insertion point for target in a sorted array.

        If target exists, returns the index after any equal entries. (Like Python's bisect_right.)

        Parameters

        • sorted_arr: (number | bigint)[]

          Sorted array (ascending).

        • target: number

          Value to locate.

        Returns number

        Insertion index.

        O(log n). Behavior is undefined if array is not sorted.

        bisectRight([1, 2, 4, 4, 6], 4); // 4
        bisectRight([1, 2, 4, 4, 6], 3); // 2