/**
 * This function finds the common elements between two lists.
 *
 * @param arr1 The first input list.
 * @param arr2 The second input list.
 * @return A new list containing the common elements.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in arr1
    for (num in arr1) {
        // Create a flag to check if the element is common
        var isCommon = false

        // Iterate through each element in arr2
        for (num2 in arr2) {
            // Check if the current element in arr1 is equal to any element in arr2
            if (num == num2) {
                isCommon = true
                break
            }
        }

        // If the element is common, add it to the list
        if (isCommon) {
            commonElements.add(num)
        }
    }

    return commonElements
}
/**
 * This function finds the common elements between two lists.
 *
 * @param arr1 The first input list.
 * @param arr2 The second input list.
 * @return A new list containing the common elements.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * This function finds the common elements between two lists.
 *
 * @param arr1 The first input list.
 * @param arr2 The second input list.
 * @return A new list containing the common elements.
 */
fun intersection(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in arr1
    for (num in arr1) {
        // Create a flag to check if the element is common
        var isCommon = false

        // Iterate through each element in arr2
        for (num2 in arr2) {
            // Check if the current element in arr1 is equal to any element in arr2
            if (num == num2) {
                isCommon = true
                break
            }
        }

        // If the element is common, add it to the list
        if (isCommon) {
            commonElements.add(num)
        }
    }

    return commonElements
}