/**
 * Given a list of numbers, this function replaces the elements that are larger than a given threshold.
 *
 * @param lst The input list of numbers.
 * @param threshold The threshold value.
 * @return The updated list with elements smaller than or equal to the threshold.
 *
 * Example:
 * replaceLargerValues(listOf(10, 15, 5, 20, 12), 10)
 * Output: [10, 10, 5, 10, 10]
 */
fun replaceLargerValues(lst: MutableList<Int>, threshold: Int): List<Int> {

    for (i in lst.indices) {
        if (lst[i] > threshold) {  // Replacing element if it is larger than the threshold
            lst[i] = threshold
        }
    }
    return lst
}
/**
 * Given a list of numbers, this function replaces the elements that are larger than a given threshold.
 *
 * @param lst The input list of numbers.
 * @param threshold The threshold value.
 * @return The updated list with elements smaller than or equal to the threshold.
 *
 * Example:
 * replaceLargerValues(listOf(10, 15, 5, 20, 12), 10)
 * Output: [10, 10, 5, 10, 10]
 */
fun replaceLargerValues(lst: MutableList<Int>, threshold: Int): List<Int> {
/**
 * Given a list of numbers, this function replaces the elements that are larger than a given threshold.
 *
 * @param lst The input list of numbers.
 * @param threshold The threshold value.
 * @return The updated list with elements smaller than or equal to the threshold.
 *
 * Example:
 * replaceLargerValues(listOf(10, 15, 5, 20, 12), 10)
 * Output: [10, 10, 5, 10, 10]
 */
fun replaceLargerValues(lst: MutableList<Int>, threshold: Int): List<Int> {

    for (i in lst.indices) {
        if (lst[i] > threshold) {  // Replacing element if it is larger than the threshold
            lst[i] = threshold
        }
    }
    return lst
}