/**
 * The function findCommonElements takes two arrays (arr1 and arr2) as input and returns a new array containing
 * the common elements found in both arrays.
 *
 * @param arr1 A list representing the first array.
 * @param arr2 A list representing the second array.
 * @return A list containing the common elements found in arr1 and arr2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6, 7)) // [3, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (num in arr1) {
        if (num in arr2) {
            commonElements.add(num)
        }
    }
    
    return commonElements
}
/**
 * The function findCommonElements takes two arrays (arr1 and arr2) as input and returns a new array containing
 * the common elements found in both arrays.
 *
 * @param arr1 A list representing the first array.
 * @param arr2 A list representing the second array.
 * @return A list containing the common elements found in arr1 and arr2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6, 7)) // [3, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * The function findCommonElements takes two arrays (arr1 and arr2) as input and returns a new array containing
 * the common elements found in both arrays.
 *
 * @param arr1 A list representing the first array.
 * @param arr2 A list representing the second array.
 * @return A list containing the common elements found in arr1 and arr2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6, 7)) // [3, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (num in arr1) {
        if (num in arr2) {
            commonElements.add(num)
        }
    }
    
    return commonElements
}