/**
 * Your best friend, an anthropologist, has been studying two ancient civilizations. He has collected some artifacts from each civilization and wants to find out if there are any common elements between them.
 * Given two lists, list1 and list2, write a function that finds and returns a list of common elements between them.
 *
 * @param list1 A list containing artifacts from the first civilization.
 * @param list2 A list containing artifacts from the second civilization.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(2, 4, 6, 8)
 * findCommonElements(list1, list2) // Output: [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (artifact1 in list1) {
        for (artifact2 in list2) {
            if (artifact1 == artifact2) {
                commonElements.add(artifact1)
                break
            }
        }
    }

    return commonElements
}
/**
 * Your best friend, an anthropologist, has been studying two ancient civilizations. He has collected some artifacts from each civilization and wants to find out if there are any common elements between them.
 * Given two lists, list1 and list2, write a function that finds and returns a list of common elements between them.
 *
 * @param list1 A list containing artifacts from the first civilization.
 * @param list2 A list containing artifacts from the second civilization.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(2, 4, 6, 8)
 * findCommonElements(list1, list2) // Output: [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Your best friend, an anthropologist, has been studying two ancient civilizations. He has collected some artifacts from each civilization and wants to find out if there are any common elements between them.
 * Given two lists, list1 and list2, write a function that finds and returns a list of common elements between them.
 *
 * @param list1 A list containing artifacts from the first civilization.
 * @param list2 A list containing artifacts from the second civilization.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * val list1 = listOf(1, 2, 3, 4, 5)
 * val list2 = listOf(2, 4, 6, 8)
 * findCommonElements(list1, list2) // Output: [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (artifact1 in list1) {
        for (artifact2 in list2) {
            if (artifact1 == artifact2) {
                commonElements.add(artifact1)
                break
            }
        }
    }

    return commonElements
}