/**
 * Given two arrays, find the common elements between them.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return List of common elements present in both arrays.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
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) {
                commonElements.add(element1)
            }
        }
    }
    return commonElements
}
/**
 * Given two arrays, find the common elements between them.
 *
 * @param array1 The first array.
 * @param array2 The second array.
 * @return List of common elements present in both arrays.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
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 List of common elements present in both arrays.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
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) {
                commonElements.add(element1)
            }
        }
    }
    return commonElements
}