/**
 * This function takes in two arrays and returns the intersection of the two arrays.
 *
 * @param array1 The first array of integers
 * @param array2 The second array of integers
 * @return The intersection of the two arrays
 *
 * Example:
 * intersectionArrays(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 */
fun intersectionArrays(array1: List<Int>, array2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (num1 in array1) {
        for (num2 in array2) {
            if (num1 == num2) {
                intersection.add(num1)
            }
        }
    }
    return intersection
}
/**
 * This function takes in two arrays and returns the intersection of the two arrays.
 *
 * @param array1 The first array of integers
 * @param array2 The second array of integers
 * @return The intersection of the two arrays
 *
 * Example:
 * intersectionArrays(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 */
fun intersectionArrays(array1: List<Int>, array2: List<Int>): List<Int> {
/**
 * This function takes in two arrays and returns the intersection of the two arrays.
 *
 * @param array1 The first array of integers
 * @param array2 The second array of integers
 * @return The intersection of the two arrays
 *
 * Example:
 * intersectionArrays(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 */
fun intersectionArrays(array1: List<Int>, array2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (num1 in array1) {
        for (num2 in array2) {
            if (num1 == num2) {
                intersection.add(num1)
            }
        }
    }
    return intersection
}