/**
 * Find the intersection of two arrays using the range function.
 *
 * @param arr1 A list containing elements of the first array.
 * @param arr2 A list containing elements of the second array.
 * @return A list of elements that are common to both arr1 and arr2.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val intersectionList = mutableListOf<Int>()

    // Iterate through each element in arr1
    for (element in arr1) {
        // Check if the element is also present in arr2
        if (element in arr2) {
            // If it is, add it to the intersectionList
            intersectionList.add(element)
        }
    }

    return intersectionList
}
/**
 * Find the intersection of two arrays using the range function.
 *
 * @param arr1 A list containing elements of the first array.
 * @param arr2 A list containing elements of the second array.
 * @return A list of elements that are common to both arr1 and arr2.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * Find the intersection of two arrays using the range function.
 *
 * @param arr1 A list containing elements of the first array.
 * @param arr2 A list containing elements of the second array.
 * @return A list of elements that are common to both arr1 and arr2.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val intersectionList = mutableListOf<Int>()

    // Iterate through each element in arr1
    for (element in arr1) {
        // Check if the element is also present in arr2
        if (element in arr2) {
            // If it is, add it to the intersectionList
            intersectionList.add(element)
        }
    }

    return intersectionList
}