/**
 * Given two lists, find the common elements present in both lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersection(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersection(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Loop through each element in lst1
    for (i in lst1) {
        // Check if the element is present in lst2 and not already in commonElements
        if (i in lst2 && i !in commonElements) {
            commonElements.add(i)
        }
    }

    return commonElements
}
/**
 * Given two lists, find the common elements present in both lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersection(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersection(lst1: List<Int>, lst2: List<Int>): List<Int> {
/**
 * Given two lists, find the common elements present in both lists.
 *
 * @param lst1 The first list.
 * @param lst2 The second list.
 * @return A new list containing the common elements.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersection(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersection(lst1: List<Int>, lst2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Loop through each element in lst1
    for (i in lst1) {
        // Check if the element is present in lst2 and not already in commonElements
        if (i in lst2 && i !in commonElements) {
            commonElements.add(i)
        }
    }

    return commonElements
}