/**
 * This function takes two arrays as input and returns a new array that contains the intersection of both input arrays.
 * The intersection of two arrays is the collection of common elements present in both arrays.
 */
fun arrayIntersection(arr1: Array<Int>, arr2: Array<Int>): List<Int> {

    // Initialize an empty list to store the common elements
    val intersection = mutableListOf<Int>()

    // Iterate over the elements in the first array
    for (elem1 in arr1) {
        // Iterate over the elements in the second array
        for (elem2 in arr2) {
            // Check if the current element from the first array is equal to the element from the second array
            if (elem1 == elem2) {
                // Check if the element is not already present in the intersection list
                if (!intersection.contains(elem1)) {
                    // If not present, add the element to the intersection list
                    intersection.add(elem1)
                }
            }
        }
    }

    return intersection
}
/**
 * This function takes two arrays as input and returns a new array that contains the intersection of both input arrays.
 * The intersection of two arrays is the collection of common elements present in both arrays.
 */
fun arrayIntersection(arr1: Array<Int>, arr2: Array<Int>): List<Int> {
/**
 * This function takes two arrays as input and returns a new array that contains the intersection of both input arrays.
 * The intersection of two arrays is the collection of common elements present in both arrays.
 */
fun arrayIntersection(arr1: Array<Int>, arr2: Array<Int>): List<Int> {

    // Initialize an empty list to store the common elements
    val intersection = mutableListOf<Int>()

    // Iterate over the elements in the first array
    for (elem1 in arr1) {
        // Iterate over the elements in the second array
        for (elem2 in arr2) {
            // Check if the current element from the first array is equal to the element from the second array
            if (elem1 == elem2) {
                // Check if the element is not already present in the intersection list
                if (!intersection.contains(elem1)) {
                    // If not present, add the element to the intersection list
                    intersection.add(elem1)
                }
            }
        }
    }

    return intersection
}