/**
 * This exercise requires implementing a function that finds the intersection of two lists using list comprehension.
 * The intersection of two lists is the list of elements that appear in both lists.
 *
 * @param A A list of integers.
 * @param B A list of integers.
 * @return A list containing the common elements between A and B.
 *
 * Example:
 * val A = listOf(1, 2, 3, 4, 5)
 * val B = listOf(4, 5, 6, 7, 8)
 * intersectionListComp(A, B) // [4, 5]
 */
fun intersectionListComp(A: List<Int>, B: List<Int>): List<Int> {

    return A.filter { it in B }
}
/**
 * This exercise requires implementing a function that finds the intersection of two lists using list comprehension.
 * The intersection of two lists is the list of elements that appear in both lists.
 *
 * @param A A list of integers.
 * @param B A list of integers.
 * @return A list containing the common elements between A and B.
 *
 * Example:
 * val A = listOf(1, 2, 3, 4, 5)
 * val B = listOf(4, 5, 6, 7, 8)
 * intersectionListComp(A, B) // [4, 5]
 */
fun intersectionListComp(A: List<Int>, B: List<Int>): List<Int> {
/**
 * This exercise requires implementing a function that finds the intersection of two lists using list comprehension.
 * The intersection of two lists is the list of elements that appear in both lists.
 *
 * @param A A list of integers.
 * @param B A list of integers.
 * @return A list containing the common elements between A and B.
 *
 * Example:
 * val A = listOf(1, 2, 3, 4, 5)
 * val B = listOf(4, 5, 6, 7, 8)
 * intersectionListComp(A, B) // [4, 5]
 */
fun intersectionListComp(A: List<Int>, B: List<Int>): List<Int> {

    return A.filter { it in B }
}