/**
 * This function takes two tuples representing number lines and returns their intersection.
 *
 * @param tup1 a tuple representing the first number line
 * @param tup2 a tuple representing the second number line
 * @return a tuple representing the intersection of the two number lines
 *
 * Example:
 * findIntersection(Pair(1, 4), Pair(3, 6)) // Pair(3, 4)
 */
fun findIntersection(tup1: Pair<Int, Int>, tup2: Pair<Int, Int>): Pair<Int, Int> {

    // Find the maximum and minimum values of the two number lines
    val minVal = maxOf(tup1.first, tup2.first)
    val maxVal = minOf(tup1.second, tup2.second)

    // Check if there is any intersection between the two number lines
    val intersection = if (minVal <= maxVal) {
        // Create a tuple with the intersection values
        Pair(minVal, maxVal)
    } else {
        // If there is no intersection, return an empty tuple
        Pair(0, 0)
    }

    return intersection
}
/**
 * This function takes two tuples representing number lines and returns their intersection.
 *
 * @param tup1 a tuple representing the first number line
 * @param tup2 a tuple representing the second number line
 * @return a tuple representing the intersection of the two number lines
 *
 * Example:
 * findIntersection(Pair(1, 4), Pair(3, 6)) // Pair(3, 4)
 */
fun findIntersection(tup1: Pair<Int, Int>, tup2: Pair<Int, Int>): Pair<Int, Int> {
/**
 * This function takes two tuples representing number lines and returns their intersection.
 *
 * @param tup1 a tuple representing the first number line
 * @param tup2 a tuple representing the second number line
 * @return a tuple representing the intersection of the two number lines
 *
 * Example:
 * findIntersection(Pair(1, 4), Pair(3, 6)) // Pair(3, 4)
 */
fun findIntersection(tup1: Pair<Int, Int>, tup2: Pair<Int, Int>): Pair<Int, Int> {

    // Find the maximum and minimum values of the two number lines
    val minVal = maxOf(tup1.first, tup2.first)
    val maxVal = minOf(tup1.second, tup2.second)

    // Check if there is any intersection between the two number lines
    val intersection = if (minVal <= maxVal) {
        // Create a tuple with the intersection values
        Pair(minVal, maxVal)
    } else {
        // If there is no intersection, return an empty tuple
        Pair(0, 0)
    }

    return intersection
}