/**
 * Takes in two arrays and finds the common elements between them.
 *
 * @param arr1 the first array
 * @param arr2 the second array
 * @return a list containing the common elements found in both arrays
 */
fun findCommonElements(arr1: Array<Int>, arr2: Array<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Loop through each element in the first array
    for (element1 in arr1) {
        // Loop through each element in the second array
        for (element2 in arr2) {
            // Check if the current elements match
            if (element1 == element2) {
                // Check if the current element is not already in the list of common elements
                if (!commonElements.contains(element1)) {
                    // Add the common element to the list
                    commonElements.add(element1)
                }
            }
        }
    }

    return commonElements
}
/**
 * Takes in two arrays and finds the common elements between them.
 *
 * @param arr1 the first array
 * @param arr2 the second array
 * @return a list containing the common elements found in both arrays
 */
fun findCommonElements(arr1: Array<Int>, arr2: Array<Int>): List<Int> {
/**
 * Takes in two arrays and finds the common elements between them.
 *
 * @param arr1 the first array
 * @param arr2 the second array
 * @return a list containing the common elements found in both arrays
 */
fun findCommonElements(arr1: Array<Int>, arr2: Array<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Loop through each element in the first array
    for (element1 in arr1) {
        // Loop through each element in the second array
        for (element2 in arr2) {
            // Check if the current elements match
            if (element1 == element2) {
                // Check if the current element is not already in the list of common elements
                if (!commonElements.contains(element1)) {
                    // Add the common element to the list
                    commonElements.add(element1)
                }
            }
        }
    }

    return commonElements
}