/**
 * Given a list 'data', an index 'index', and a list of new elements 'newElements',
 * replace the elements in 'data' at the specified index and return the modified list.
 *
 * Example:
 * data = [1, 2, 3, 4, 5]
 * index = 2
 * newElements = [9, 8, 7]
 * replaceElements(data, index, newElements) -> [1, 2, 9, 8, 7, 5]
 */
fun replaceElements(data: MutableList<Int>, index: Int, newElements: List<Int>): List<Int> {

    for (i in newElements.indices) {
        data[index + i] = newElements[i]
    }
    return data
}
/**
 * Given a list 'data', an index 'index', and a list of new elements 'newElements',
 * replace the elements in 'data' at the specified index and return the modified list.
 *
 * Example:
 * data = [1, 2, 3, 4, 5]
 * index = 2
 * newElements = [9, 8, 7]
 * replaceElements(data, index, newElements) -> [1, 2, 9, 8, 7, 5]
 */
fun replaceElements(data: MutableList<Int>, index: Int, newElements: List<Int>): List<Int> {
/**
 * Given a list 'data', an index 'index', and a list of new elements 'newElements',
 * replace the elements in 'data' at the specified index and return the modified list.
 *
 * Example:
 * data = [1, 2, 3, 4, 5]
 * index = 2
 * newElements = [9, 8, 7]
 * replaceElements(data, index, newElements) -> [1, 2, 9, 8, 7, 5]
 */
fun replaceElements(data: MutableList<Int>, index: Int, newElements: List<Int>): List<Int> {

    for (i in newElements.indices) {
        data[index + i] = newElements[i]
    }
    return data
}