/**
 * Given two lists, find the common elements between them and return a new list,
 * without repeating any element.
 *
 * @param list1 the first list of integers
 * @param list2 the second list of integers
 * @return a new list containing the common elements between list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = list1.filter { it in list2 }
    return commonElements.toSet().toList()
}
/**
 * Given two lists, find the common elements between them and return a new list,
 * without repeating any element.
 *
 * @param list1 the first list of integers
 * @param list2 the second list of integers
 * @return a new list containing the common elements between list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists, find the common elements between them and return a new list,
 * without repeating any element.
 *
 * @param list1 the first list of integers
 * @param list2 the second list of integers
 * @return a new list containing the common elements between list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = list1.filter { it in list2 }
    return commonElements.toSet().toList()
}