/**
 * Given a list, change the value of an element at a specific index to a new value.
 *
 * @param inputList The input list.
 * @param index The index of the element to be changed.
 * @param newValue The new value to be assigned to the element.
 * @return The modified list.
 *
 * Example:
 * changeElements(listOf(1, 2, 3, 4, 5), 2, 9) -> [1, 2, 9, 4, 5]
 */
fun changeElements(inputList: MutableList<Int>, index: Int, newValue: Int): List<Int> {

    // Use a for loop to iterate over the inputList
    for (i in inputList.indices) {
        // Check if the current index matches the specified index
        if (i == index) {
            // Change the element at the specified index to the new value
            inputList[i] = newValue
        }
    }
    // Return the modified list
    return inputList
}
/**
 * Given a list, change the value of an element at a specific index to a new value.
 *
 * @param inputList The input list.
 * @param index The index of the element to be changed.
 * @param newValue The new value to be assigned to the element.
 * @return The modified list.
 *
 * Example:
 * changeElements(listOf(1, 2, 3, 4, 5), 2, 9) -> [1, 2, 9, 4, 5]
 */
fun changeElements(inputList: MutableList<Int>, index: Int, newValue: Int): List<Int> {
/**
 * Given a list, change the value of an element at a specific index to a new value.
 *
 * @param inputList The input list.
 * @param index The index of the element to be changed.
 * @param newValue The new value to be assigned to the element.
 * @return The modified list.
 *
 * Example:
 * changeElements(listOf(1, 2, 3, 4, 5), 2, 9) -> [1, 2, 9, 4, 5]
 */
fun changeElements(inputList: MutableList<Int>, index: Int, newValue: Int): List<Int> {

    // Use a for loop to iterate over the inputList
    for (i in inputList.indices) {
        // Check if the current index matches the specified index
        if (i == index) {
            // Change the element at the specified index to the new value
            inputList[i] = newValue
        }
    }
    // Return the modified list
    return inputList
}