/**
 * This function takes in two lists and returns a new list containing the common elements found in both lists.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8, 10)) -> [2, 4]
 * intersection(listOf('a', 'b', 'c'), listOf('b', 'd', 'e')) -> ['b']
 * intersection(emptyList(), listOf(1, 2, 3)) -> []
 *
 * Use the 'in' operator to check if an element is present in a list.
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the elements in list1
    for (element in list1) {
        // Check if the current element is also present in list2
        if (element in list2) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * This function takes in two lists and returns a new list containing the common elements found in both lists.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8, 10)) -> [2, 4]
 * intersection(listOf('a', 'b', 'c'), listOf('b', 'd', 'e')) -> ['b']
 * intersection(emptyList(), listOf(1, 2, 3)) -> []
 *
 * Use the 'in' operator to check if an element is present in a list.
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function takes in two lists and returns a new list containing the common elements found in both lists.
 *
 * Example:
 * intersection(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8, 10)) -> [2, 4]
 * intersection(listOf('a', 'b', 'c'), listOf('b', 'd', 'e')) -> ['b']
 * intersection(emptyList(), listOf(1, 2, 3)) -> []
 *
 * Use the 'in' operator to check if an element is present in a list.
 */
fun intersection(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate over the elements in list1
    for (element in list1) {
        // Check if the current element is also present in list2
        if (element in list2) {
            commonElements.add(element)
        }
    }

    return commonElements
}