/**
 * Given a sorted list of numbers and a target value, this function returns the index of the target value in the list.
 * If the target value does not exist in the list, it returns -1.
 *
 * @param numbers A sorted list of numbers.
 * @param target The value to be searched for in the list.
 * @return The index of the target value in the list, or -1 if it does not exist.
 */
fun findIndex(numbers: List<Int>, target: Int): Int {

    var left = 0
    var right = numbers.size - 1

    while (left <= right) {
        val mid = (left + right) / 2
        when {
            numbers[mid] < target -> left = mid + 1
            numbers[mid] > target -> right = mid - 1
            else -> return mid
        }
    }

    return -1
}
/**
 * Given a sorted list of numbers and a target value, this function returns the index of the target value in the list.
 * If the target value does not exist in the list, it returns -1.
 *
 * @param numbers A sorted list of numbers.
 * @param target The value to be searched for in the list.
 * @return The index of the target value in the list, or -1 if it does not exist.
 */
fun findIndex(numbers: List<Int>, target: Int): Int {
/**
 * Given a sorted list of numbers and a target value, this function returns the index of the target value in the list.
 * If the target value does not exist in the list, it returns -1.
 *
 * @param numbers A sorted list of numbers.
 * @param target The value to be searched for in the list.
 * @return The index of the target value in the list, or -1 if it does not exist.
 */
fun findIndex(numbers: List<Int>, target: Int): Int {

    var left = 0
    var right = numbers.size - 1

    while (left <= right) {
        val mid = (left + right) / 2
        when {
            numbers[mid] < target -> left = mid + 1
            numbers[mid] > target -> right = mid - 1
            else -> return mid
        }
    }

    return -1
}