/**
 * This function takes two lists as input and returns a new list with the common elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, 4)
 * val list2 = listOf(4, 5, 6, 7)
 * findCommonElements(list1, list2) // [4]
 * '``
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}
/**
 * This function takes two lists as input and returns a new list with the common elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, 4)
 * val list2 = listOf(4, 5, 6, 7)
 * findCommonElements(list1, list2) // [4]
 * '``
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This function takes two lists as input and returns a new list with the common elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A new list containing the common elements between list1 and list2.
 *
 * Example:
 * '``
 * val list1 = listOf(1, 2, 3, 4)
 * val list2 = listOf(4, 5, 6, 7)
 * findCommonElements(list1, list2) // [4]
 * '``
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}