/**
 * Given two arrays arr1 and arr2, this function returns a new array containing common elements
 * present in both arr1 and arr2. If there are no common elements, it returns an empty array.
 *
 * @param arr1 First array
 * @param arr2 Second array
 * @return Array containing common elements in arr1 and arr2, or an empty array if there are no common elements.
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (elem1 in arr1) {
        for (elem2 in arr2) {
            if (elem1 == elem2) {
                commonElements.add(elem1)
            }
        }
    }

    return commonElements
}
/**
 * Given two arrays arr1 and arr2, this function returns a new array containing common elements
 * present in both arr1 and arr2. If there are no common elements, it returns an empty array.
 *
 * @param arr1 First array
 * @param arr2 Second array
 * @return Array containing common elements in arr1 and arr2, or an empty array if there are no common elements.
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * Given two arrays arr1 and arr2, this function returns a new array containing common elements
 * present in both arr1 and arr2. If there are no common elements, it returns an empty array.
 *
 * @param arr1 First array
 * @param arr2 Second array
 * @return Array containing common elements in arr1 and arr2, or an empty array if there are no common elements.
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (elem1 in arr1) {
        for (elem2 in arr2) {
            if (elem1 == elem2) {
                commonElements.add(elem1)
            }
        }
    }

    return commonElements
}