/**
 * Given two arrays array1 and array2, modify array1 by subtracting the element at each index of array2 from the corresponding element in array1.
 *
 * @param array1 the first array
 * @param array2 the second array
 * @return Modified array1 after subtracting the elements of array2 from it.
 *
 * Example:
 * modifyArray(listOf(7, 9, 12, 5, 10), listOf(2, 4, 6, 1, 3))
 * Output: [5, 5, 6, 4, 7]
 */
fun modifyArray(array1: MutableList<Int>, array2: List<Int>): List<Int> {

    require(array1.size == array2.size) { "Arrays must have the same length" }

    for (i in array1.indices) {
        array1[i] -= array2[i]
    }

    return array1
}
/**
 * Given two arrays array1 and array2, modify array1 by subtracting the element at each index of array2 from the corresponding element in array1.
 *
 * @param array1 the first array
 * @param array2 the second array
 * @return Modified array1 after subtracting the elements of array2 from it.
 *
 * Example:
 * modifyArray(listOf(7, 9, 12, 5, 10), listOf(2, 4, 6, 1, 3))
 * Output: [5, 5, 6, 4, 7]
 */
fun modifyArray(array1: MutableList<Int>, array2: List<Int>): List<Int> {
/**
 * Given two arrays array1 and array2, modify array1 by subtracting the element at each index of array2 from the corresponding element in array1.
 *
 * @param array1 the first array
 * @param array2 the second array
 * @return Modified array1 after subtracting the elements of array2 from it.
 *
 * Example:
 * modifyArray(listOf(7, 9, 12, 5, 10), listOf(2, 4, 6, 1, 3))
 * Output: [5, 5, 6, 4, 7]
 */
fun modifyArray(array1: MutableList<Int>, array2: List<Int>): List<Int> {

    require(array1.size == array2.size) { "Arrays must have the same length" }

    for (i in array1.indices) {
        array1[i] -= array2[i]
    }

    return array1
}