/**
 * This function takes two arrays as input and returns the intersection of the two arrays,
 * after multiplying each element of the intersection with its corresponding index value.
 */
fun multiplyArrays(array1: IntArray, array2: IntArray): IntArray {

    val intersection = mutableListOf<Int>()

    // Finding the intersection of the arrays
    for (num1 in array1) {
        if (num1 in array2) {
            intersection.add(num1)
        }
    }

    // Multiplying the elements of the intersection with their corresponding index value
    val multipliedArray = mutableListOf<Int>()
    for ((index, num) in intersection.withIndex()) {
        multipliedArray.add(num * index)
    }

    return multipliedArray.toIntArray()
}
/**
 * This function takes two arrays as input and returns the intersection of the two arrays,
 * after multiplying each element of the intersection with its corresponding index value.
 */
fun multiplyArrays(array1: IntArray, array2: IntArray): IntArray {
/**
 * This function takes two arrays as input and returns the intersection of the two arrays,
 * after multiplying each element of the intersection with its corresponding index value.
 */
fun multiplyArrays(array1: IntArray, array2: IntArray): IntArray {

    val intersection = mutableListOf<Int>()

    // Finding the intersection of the arrays
    for (num1 in array1) {
        if (num1 in array2) {
            intersection.add(num1)
        }
    }

    // Multiplying the elements of the intersection with their corresponding index value
    val multipliedArray = mutableListOf<Int>()
    for ((index, num) in intersection.withIndex()) {
        multipliedArray.add(num * index)
    }

    return multipliedArray.toIntArray()
}