/**
 * Given two arrays, find the common elements between them.
 *
 * @param list1 The first array.
 * @param list2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over each element in list1
    for (elem in list1) {
        // Check if the element exists in list2
        if (elem in list2) {
            // Add the element to the commonElements list
            commonElements.add(elem)
        }
    }

    return commonElements
}
/**
 * Given two arrays, find the common elements between them.
 *
 * @param list1 The first array.
 * @param list2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two arrays, find the common elements between them.
 *
 * @param list1 The first array.
 * @param list2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over each element in list1
    for (elem in list1) {
        // Check if the element exists in list2
        if (elem in list2) {
            // Add the element to the commonElements list
            commonElements.add(elem)
        }
    }

    return commonElements
}