/**
 * This function finds the intersection of two arrays by using the enumerate function.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun intersectionArraysEnumerate(array1: List<Int>, array2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    for ((idx1, num1) in array1.withIndex()) {
        for ((idx2, num2) in array2.withIndex()) {
            if (num1 == num2 && num1 !in intersection) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}
/**
 * This function finds the intersection of two arrays by using the enumerate function.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun intersectionArraysEnumerate(array1: List<Int>, array2: List<Int>): List<Int> {
/**
 * This function finds the intersection of two arrays by using the enumerate function.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun intersectionArraysEnumerate(array1: List<Int>, array2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    for ((idx1, num1) in array1.withIndex()) {
        for ((idx2, num2) in array2.withIndex()) {
            if (num1 == num2 && num1 !in intersection) {
                intersection.add(num1)
            }
        }
    }

    return intersection
}