/**
 * This function takes in two arrays and returns a new array containing only the common elements between them,
 * where the elements are divisible by both 2 and 5.
 *
 * @param arr1 The first array
 * @param arr2 The second array
 * @return An array containing the common elements divisible by both 2 and 5.
 *
 * Example:
 * Input:
 * arr1 = [10, 15, 25, 30, 35, 40]
 * arr2 = [10, 20, 25, 30, 35, 40]
 *
 * Output:
 * [10, 30, 40]
 *
 * Note:
 * In the above example, only the elements 10, 30, and 40 are divisible by both 2 and 5, so they are included in the result.
 */
fun arrayModulusIntersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num1 in arr1) {
        if (num1 % 2 == 0 && num1 % 5 == 0) {
            for (num2 in arr2) {
                if (num2 == num1) {
                    commonElements.add(num1)
                    break
                }
            }
        }
    }

    return commonElements
}
/**
 * This function takes in two arrays and returns a new array containing only the common elements between them,
 * where the elements are divisible by both 2 and 5.
 *
 * @param arr1 The first array
 * @param arr2 The second array
 * @return An array containing the common elements divisible by both 2 and 5.
 *
 * Example:
 * Input:
 * arr1 = [10, 15, 25, 30, 35, 40]
 * arr2 = [10, 20, 25, 30, 35, 40]
 *
 * Output:
 * [10, 30, 40]
 *
 * Note:
 * In the above example, only the elements 10, 30, and 40 are divisible by both 2 and 5, so they are included in the result.
 */
fun arrayModulusIntersection(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * This function takes in two arrays and returns a new array containing only the common elements between them,
 * where the elements are divisible by both 2 and 5.
 *
 * @param arr1 The first array
 * @param arr2 The second array
 * @return An array containing the common elements divisible by both 2 and 5.
 *
 * Example:
 * Input:
 * arr1 = [10, 15, 25, 30, 35, 40]
 * arr2 = [10, 20, 25, 30, 35, 40]
 *
 * Output:
 * [10, 30, 40]
 *
 * Note:
 * In the above example, only the elements 10, 30, and 40 are divisible by both 2 and 5, so they are included in the result.
 */
fun arrayModulusIntersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num1 in arr1) {
        if (num1 % 2 == 0 && num1 % 5 == 0) {
            for (num2 in arr2) {
                if (num2 == num1) {
                    commonElements.add(num1)
                    break
                }
            }
        }
    }

    return commonElements
}