/**
 * Given a sorted array of integers in ascending order, find the index of the first element that is greater than
 * or equal to the target value.
 *
 * @param arr A sorted list of integers in ascending order.
 * @param target An integer representing the value to search for.
 * @return An integer representing the index of the first element greater than or equal to the target value.
 * If no such element exists, returns -1.
 */
fun findGreaterEqual(arr: List<Int>, target: Int): Int {

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

    while (left <= right) {
        val mid = (left + right) / 2

        when {
            arr[mid] < target -> left = mid + 1
            arr[mid] >= target -> return mid
            else -> return -1
        }
    }

    return -1
}
/**
 * Given a sorted array of integers in ascending order, find the index of the first element that is greater than
 * or equal to the target value.
 *
 * @param arr A sorted list of integers in ascending order.
 * @param target An integer representing the value to search for.
 * @return An integer representing the index of the first element greater than or equal to the target value.
 * If no such element exists, returns -1.
 */
fun findGreaterEqual(arr: List<Int>, target: Int): Int {
/**
 * Given a sorted array of integers in ascending order, find the index of the first element that is greater than
 * or equal to the target value.
 *
 * @param arr A sorted list of integers in ascending order.
 * @param target An integer representing the value to search for.
 * @return An integer representing the index of the first element greater than or equal to the target value.
 * If no such element exists, returns -1.
 */
fun findGreaterEqual(arr: List<Int>, target: Int): Int {

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

    while (left <= right) {
        val mid = (left + right) / 2

        when {
            arr[mid] < target -> left = mid + 1
            arr[mid] >= target -> return mid
            else -> return -1
        }
    }

    return -1
}