/**
 * Find the common elements between two arrays.
 *
 * Given two arrays of integers, 'arr1' and 'arr2', implement a function to find the common elements
 * between them. The function should return a new array containing the common elements.
 *
 * @param arr1 A list of integers.
 * @param arr2 A list of integers.
 * @return A list of integers containing the common elements between arr1 and arr2.
 *
 * Example:
 * ----------
 * Input:
 * arr1 = [2, 4, 6, 8, 10]
 * arr2 = [1, 2, 3, 4, 5]
 * Output:
 * [2, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num in arr1) {
        if (num in arr2 && num !in commonElements) {
            commonElements.add(num)
        }
    }

    return commonElements
}
/**
 * Find the common elements between two arrays.
 *
 * Given two arrays of integers, 'arr1' and 'arr2', implement a function to find the common elements
 * between them. The function should return a new array containing the common elements.
 *
 * @param arr1 A list of integers.
 * @param arr2 A list of integers.
 * @return A list of integers containing the common elements between arr1 and arr2.
 *
 * Example:
 * ----------
 * Input:
 * arr1 = [2, 4, 6, 8, 10]
 * arr2 = [1, 2, 3, 4, 5]
 * Output:
 * [2, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {
/**
 * Find the common elements between two arrays.
 *
 * Given two arrays of integers, 'arr1' and 'arr2', implement a function to find the common elements
 * between them. The function should return a new array containing the common elements.
 *
 * @param arr1 A list of integers.
 * @param arr2 A list of integers.
 * @return A list of integers containing the common elements between arr1 and arr2.
 *
 * Example:
 * ----------
 * Input:
 * arr1 = [2, 4, 6, 8, 10]
 * arr2 = [1, 2, 3, 4, 5]
 * Output:
 * [2, 4]
 */
fun findCommonElements(arr1: List<Int>, arr2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (num in arr1) {
        if (num in arr2 && num !in commonElements) {
            commonElements.add(num)
        }
    }

    return commonElements
}