/**
 * Given two lists, check if there are any duplicate elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return True if there are duplicate elements, False otherwise.
 *
 * Example:
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(5, 6, 7, 8)) -> false
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> true
 */
fun checkDuplicates(list1: List<Int>, list2: List<Int>): Boolean {

    val commonElements = list1.filter { it in list2 }
    return commonElements.isNotEmpty()
}
/**
 * Given two lists, check if there are any duplicate elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return True if there are duplicate elements, False otherwise.
 *
 * Example:
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(5, 6, 7, 8)) -> false
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> true
 */
fun checkDuplicates(list1: List<Int>, list2: List<Int>): Boolean {
/**
 * Given two lists, check if there are any duplicate elements between them.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return True if there are duplicate elements, False otherwise.
 *
 * Example:
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(5, 6, 7, 8)) -> false
 * checkDuplicates(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) -> true
 */
fun checkDuplicates(list1: List<Int>, list2: List<Int>): Boolean {

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