/**
 * Given two lists, returns a new list containing the common elements between both lists.
 *
 * @param lst1 a list of elements (could be any type)
 * @param lst2 a list of elements (could be any type)
 * @return A new list containing the elements that appear in both lst1 and lst2
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersection(listOf(1, 2, 3, 4, 5), listOf(6, 7, 8, 9, 10)) => []
 */
fun intersection(lst1: List<Any>, lst2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    lst1.forEach { element ->
        if (element in lst2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Given two lists, returns a new list containing the common elements between both lists.
 *
 * @param lst1 a list of elements (could be any type)
 * @param lst2 a list of elements (could be any type)
 * @return A new list containing the elements that appear in both lst1 and lst2
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersection(listOf(1, 2, 3, 4, 5), listOf(6, 7, 8, 9, 10)) => []
 */
fun intersection(lst1: List<Any>, lst2: List<Any>): List<Any> {
/**
 * Given two lists, returns a new list containing the common elements between both lists.
 *
 * @param lst1 a list of elements (could be any type)
 * @param lst2 a list of elements (could be any type)
 * @return A new list containing the elements that appear in both lst1 and lst2
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersection(listOf(1, 2, 3, 4, 5), listOf(6, 7, 8, 9, 10)) => []
 */
fun intersection(lst1: List<Any>, lst2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    lst1.forEach { element ->
        if (element in lst2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}