/**
 * Given an engineer's name and two tuples, this function checks if there is any intersection
 * between the two tuples. If there is an intersection, it returns true; otherwise, it returns false.
 *
 * @param engineer The name of the engineer.
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @return true if there is an intersection, false otherwise.
 */
fun checkIntersection(engineer: String, tuple1: List<Int>, tuple2: List<Int>): Boolean {

    // Sorting the tuples in ascending order
    val sortedTuple1 = tuple1.sorted()
    val sortedTuple2 = tuple2.sorted()

    // Finding the intersection of the two tuples
    val intersection = sortedTuple1.filter { it in sortedTuple2 }

    // Checking if there is an intersection
    return if (intersection.isNotEmpty()) {
        engineer == "John"
    } else {
        false
    }
}
/**
 * Given an engineer's name and two tuples, this function checks if there is any intersection
 * between the two tuples. If there is an intersection, it returns true; otherwise, it returns false.
 *
 * @param engineer The name of the engineer.
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @return true if there is an intersection, false otherwise.
 */
fun checkIntersection(engineer: String, tuple1: List<Int>, tuple2: List<Int>): Boolean {
/**
 * Given an engineer's name and two tuples, this function checks if there is any intersection
 * between the two tuples. If there is an intersection, it returns true; otherwise, it returns false.
 *
 * @param engineer The name of the engineer.
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @return true if there is an intersection, false otherwise.
 */
fun checkIntersection(engineer: String, tuple1: List<Int>, tuple2: List<Int>): Boolean {

    // Sorting the tuples in ascending order
    val sortedTuple1 = tuple1.sorted()
    val sortedTuple2 = tuple2.sorted()

    // Finding the intersection of the two tuples
    val intersection = sortedTuple1.filter { it in sortedTuple2 }

    // Checking if there is an intersection
    return if (intersection.isNotEmpty()) {
        engineer == "John"
    } else {
        false
    }
}