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

    val commonElements = mutableListOf<Int>()

    for (element1 in array1) {
        for (element2 in array2) {
            if (element1 <= element2) {
                if (element1 == element2) {
                    commonElements.add(element1)
                }
                break
            }
        }
    }
    return commonElements
}
/**
 * Given two arrays, find the common elements between them.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun findCommonElements(array1: List<Int>, array2: List<Int>): List<Int> {
/**
 * Given two arrays, find the common elements between them.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return A list containing the common elements between the two arrays.
 */
fun findCommonElements(array1: List<Int>, array2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (element1 in array1) {
        for (element2 in array2) {
            if (element1 <= element2) {
                if (element1 == element2) {
                    commonElements.add(element1)
                }
                break
            }
        }
    }
    return commonElements
}