/**
 * Find the intersection of two lists using list comprehension.
 *
 * @param list1 A list of integers.
 * @param list2 A list of integers.
 * @return A list containing the common elements present in both lists.
 *
 * Example:
 * intersectionExample(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersectionExample(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersectionExample(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = list1.filter { it in list2 }
    return intersection
}
/**
 * Find the intersection of two lists using list comprehension.
 *
 * @param list1 A list of integers.
 * @param list2 A list of integers.
 * @return A list containing the common elements present in both lists.
 *
 * Example:
 * intersectionExample(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersectionExample(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersectionExample(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Find the intersection of two lists using list comprehension.
 *
 * @param list1 A list of integers.
 * @param list2 A list of integers.
 * @return A list containing the common elements present in both lists.
 *
 * Example:
 * intersectionExample(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) // [4, 5]
 * intersectionExample(listOf(10, 20, 30), listOf(40, 50, 60)) // []
 */
fun intersectionExample(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = list1.filter { it in list2 }
    return intersection
}