/**
 * Given two number lines represented by their start and end points,
 * find the intersection between them.
 *
 * @param start1 The start point of the first number line.
 * @param end1 The end point of the first number line.
 * @param start2 The start point of the second number line.
 * @param end2 The end point of the second number line.
 * @return A Pair representing the intersection points of the two number lines.
 * If there is no intersection, return an empty Pair.
 *
 * Example:
 * numberLineIntersection(1, 10, 5, 15) -> Pair(5, 10)
 * numberLineIntersection(1, 5, 6, 8) -> Pair(null, null)
 */
fun numberLineIntersection(start1: Int, end1: Int, start2: Int, end2: Int): Pair<Int?, Int?> {

    // Find the maximum start point and the minimum end point
    val maxStart = maxOf(start1, start2)
    val minEnd = minOf(end1, end2)

    // Check if there is an intersection
    return if (maxStart <= minEnd) {
        Pair(maxStart, minEnd)
    } else {
        Pair(null, null)
    }
}
/**
 * Given two number lines represented by their start and end points,
 * find the intersection between them.
 *
 * @param start1 The start point of the first number line.
 * @param end1 The end point of the first number line.
 * @param start2 The start point of the second number line.
 * @param end2 The end point of the second number line.
 * @return A Pair representing the intersection points of the two number lines.
 * If there is no intersection, return an empty Pair.
 *
 * Example:
 * numberLineIntersection(1, 10, 5, 15) -> Pair(5, 10)
 * numberLineIntersection(1, 5, 6, 8) -> Pair(null, null)
 */
fun numberLineIntersection(start1: Int, end1: Int, start2: Int, end2: Int): Pair<Int?, Int?> {
/**
 * Given two number lines represented by their start and end points,
 * find the intersection between them.
 *
 * @param start1 The start point of the first number line.
 * @param end1 The end point of the first number line.
 * @param start2 The start point of the second number line.
 * @param end2 The end point of the second number line.
 * @return A Pair representing the intersection points of the two number lines.
 * If there is no intersection, return an empty Pair.
 *
 * Example:
 * numberLineIntersection(1, 10, 5, 15) -> Pair(5, 10)
 * numberLineIntersection(1, 5, 6, 8) -> Pair(null, null)
 */
fun numberLineIntersection(start1: Int, end1: Int, start2: Int, end2: Int): Pair<Int?, Int?> {

    // Find the maximum start point and the minimum end point
    val maxStart = maxOf(start1, start2)
    val minEnd = minOf(end1, end2)

    // Check if there is an intersection
    return if (maxStart <= minEnd) {
        Pair(maxStart, minEnd)
    } else {
        Pair(null, null)
    }
}