Skip to main content

bisect_keep_right

Find the index of the first element from the end of the array that verifies the given condition. The function is applied from the pivot to the end of array.

def bisect_keep_right(
a: list,
fn: callable
) - > int

Find the index of the first element from the end of the array that verifies the given condition. The function is applied from the pivot to the end of array.

Parameters

NameTypeDescription
alistThe sequence of elements to be searched using the bisection algorithm.
fncallableA predicate function that takes a slice of the array from the current pivot to the end and returns a boolean value.

Returns

TypeDescription
intThe index of the first element from the end that satisfies the condition, or the length of the array if no elements satisfy it.