/**
 * This function takes two lists as input and returns a new list that contains the common elements between the two lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Exercise:
 * 1. Create a new list called 'commonElements' and set it as an empty list.
 * 2. Iterate through each element 'elem' in lst1.
 * 3. Check if 'elem' is in lst2 using an appropriate list method.
 * 4. If 'elem' is present in lst2, append it to the 'commonElements' list.
 * 5. Finally, return the 'commonElements' list.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (elem in lst1) {
        if (elem in lst2) {
            commonElements.add(elem)
        }
    }
    return commonElements
}
/**
 * This function takes two lists as input and returns a new list that contains the common elements between the two lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Exercise:
 * 1. Create a new list called 'commonElements' and set it as an empty list.
 * 2. Iterate through each element 'elem' in lst1.
 * 3. Check if 'elem' is in lst2 using an appropriate list method.
 * 4. If 'elem' is present in lst2, append it to the 'commonElements' list.
 * 5. Finally, return the 'commonElements' list.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {
/**
 * This function takes two lists as input and returns a new list that contains the common elements between the two lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements between lst1 and lst2.
 *
 * Exercise:
 * 1. Create a new list called 'commonElements' and set it as an empty list.
 * 2. Iterate through each element 'elem' in lst1.
 * 3. Check if 'elem' is in lst2 using an appropriate list method.
 * 4. If 'elem' is present in lst2, append it to the 'commonElements' list.
 * 5. Finally, return the 'commonElements' list.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (elem in lst1) {
        if (elem in lst2) {
            commonElements.add(elem)
        }
    }
    return commonElements
}