/**
 * This function takes in two arrays and returns the count of common elements present in both arrays.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The count of common elements.
 *
 * Examples:
 * countIntersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) // 2
 * countIntersection(listOf(10, 20, 30), listOf(40, 50, 60)) // 0
 * countIntersection(emptyList(), listOf(1, 2, 3)) // 0
 */
fun countIntersection(arr1: List<Int>, arr2: List<Int>): Int {

    var commonCount = 0

    // Loop through each element of arr1
    for (element in arr1) {
        // Check if the element is present in arr2
        if (element in arr2) {
            commonCount++
        }
    }

    return commonCount
}
/**
 * This function takes in two arrays and returns the count of common elements present in both arrays.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The count of common elements.
 *
 * Examples:
 * countIntersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) // 2
 * countIntersection(listOf(10, 20, 30), listOf(40, 50, 60)) // 0
 * countIntersection(emptyList(), listOf(1, 2, 3)) // 0
 */
fun countIntersection(arr1: List<Int>, arr2: List<Int>): Int {
/**
 * This function takes in two arrays and returns the count of common elements present in both arrays.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The count of common elements.
 *
 * Examples:
 * countIntersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7)) // 2
 * countIntersection(listOf(10, 20, 30), listOf(40, 50, 60)) // 0
 * countIntersection(emptyList(), listOf(1, 2, 3)) // 0
 */
fun countIntersection(arr1: List<Int>, arr2: List<Int>): Int {

    var commonCount = 0

    // Loop through each element of arr1
    for (element in arr1) {
        // Check if the element is present in arr2
        if (element in arr2) {
            commonCount++
        }
    }

    return commonCount
}