/**
 * Given a list and an index, this function modifies the element at the given index with the new value.
 *
 * @param lst The list containing elements to be modified.
 * @param index The index at which the element needs to be modified.
 * @param newValue The new value to replace the element at the given index.
 * @return The modified list.
 * @throws IndexOutOfBoundsException If the given index is out of range.
 *
 * Examples:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, "new") => [1, 2, "new", 4, 5]
 * modifyElements(listOf(1, 2, 3, 4, 5), 6, "new") => IndexOutOfBoundsException: list index out of range
 */
fun modifyElements(lst: MutableList<Any>, index: Int, newValue: Any): List<Any> {

    if (index >= lst.size || index < 0) {
        throw IndexOutOfBoundsException("list index out of range")
    }

    lst[index] = newValue
    return lst
}

// Exercise
// Consider you are given a list of marketing channels used in a campaign.
// Your task is
/**
 * Given a list and an index, this function modifies the element at the given index with the new value.
 *
 * @param lst The list containing elements to be modified.
 * @param index The index at which the element needs to be modified.
 * @param newValue The new value to replace the element at the given index.
 * @return The modified list.
 * @throws IndexOutOfBoundsException If the given index is out of range.
 *
 * Examples:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, "new") => [1, 2, "new", 4, 5]
 * modifyElements(listOf(1, 2, 3, 4, 5), 6, "new") => IndexOutOfBoundsException: list index out of range
 */
fun modifyElements(lst: MutableList<Any>, index: Int, newValue: Any): List<Any> {
/**
 * Given a list and an index, this function modifies the element at the given index with the new value.
 *
 * @param lst The list containing elements to be modified.
 * @param index The index at which the element needs to be modified.
 * @param newValue The new value to replace the element at the given index.
 * @return The modified list.
 * @throws IndexOutOfBoundsException If the given index is out of range.
 *
 * Examples:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, "new") => [1, 2, "new", 4, 5]
 * modifyElements(listOf(1, 2, 3, 4, 5), 6, "new") => IndexOutOfBoundsException: list index out of range
 */
fun modifyElements(lst: MutableList<Any>, index: Int, newValue: Any): List<Any> {

    if (index >= lst.size || index < 0) {
        throw IndexOutOfBoundsException("list index out of range")
    }

    lst[index] = newValue
    return lst
}

// Exercise
// Consider you are given a list of marketing channels used in a campaign.
// Your task is