/**
 * Given two lists, [listA] and [listB], finds and returns the common elements between them using list comprehension.
 *
 * @param listA The first list.
 * @param listB The second list.
 * @return A new list containing the common elements between [listA] and [listB].
 *
 * Example:
 * Input:
 * listA = listOf(2, 4, 6, 8, 10)
 * listB = listOf(1, 3, 5, 7, 8, 9, 10)
 *
 * Output:
 * commonElements = [8, 10]
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {

    return listA.filter { it in listB }
}
/**
 * Given two lists, [listA] and [listB], finds and returns the common elements between them using list comprehension.
 *
 * @param listA The first list.
 * @param listB The second list.
 * @return A new list containing the common elements between [listA] and [listB].
 *
 * Example:
 * Input:
 * listA = listOf(2, 4, 6, 8, 10)
 * listB = listOf(1, 3, 5, 7, 8, 9, 10)
 *
 * Output:
 * commonElements = [8, 10]
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {
/**
 * Given two lists, [listA] and [listB], finds and returns the common elements between them using list comprehension.
 *
 * @param listA The first list.
 * @param listB The second list.
 * @return A new list containing the common elements between [listA] and [listB].
 *
 * Example:
 * Input:
 * listA = listOf(2, 4, 6, 8, 10)
 * listB = listOf(1, 3, 5, 7, 8, 9, 10)
 *
 * Output:
 * commonElements = [8, 10]
 */
fun findCommonElements(listA: List<Int>, listB: List<Int>): List<Int> {

    return listA.filter { it in listB }
}