/**
 * Given two lists, determine the common elements present in both lists and return them.
 *
 * @param lst1 the first list containing elements
 * @param lst2 the second list containing elements
 * @return a list of common elements present in both lst1 and lst2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) -> listOf(4, 5)
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in lst1
    for (element in lst1) {
        // Check if the element is also present in lst2
        if (element in lst2) {
            // Append the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two lists, determine the common elements present in both lists and return them.
 *
 * @param lst1 the first list containing elements
 * @param lst2 the second list containing elements
 * @return a list of common elements present in both lst1 and lst2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) -> listOf(4, 5)
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {
/**
 * Given two lists, determine the common elements present in both lists and return them.
 *
 * @param lst1 the first list containing elements
 * @param lst2 the second list containing elements
 * @return a list of common elements present in both lst1 and lst2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) -> listOf(4, 5)
 */
fun findCommonElements(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in lst1
    for (element in lst1) {
        // Check if the element is also present in lst2
        if (element in lst2) {
            // Append the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}