/**
 * This function takes two lists as input and finds the common elements
 * between them, returning a list containing the common elements.
 *
 * @param list1 First list of elements.
 * @param list2 Second list of elements.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                commonElements.add(num1)
            }
        }
    }
    return commonElements
}
/**
 * This function takes two lists as input and finds the common elements
 * between them, returning a list containing the common elements.
 *
 * @param list1 First list of elements.
 * @param list2 Second list of elements.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This function takes two lists as input and finds the common elements
 * between them, returning a list containing the common elements.
 *
 * @param list1 First list of elements.
 * @param list2 Second list of elements.
 * @return A list containing the common elements between list1 and list2.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                commonElements.add(num1)
            }
        }
    }
    return commonElements
}