/**
 * Finds the intersection of two number line representations.
 *
 * @param range1 A list representing the first number line range.
 * @param range2 A list representing the second number line range.
 * @return A list representing the intersection of the two number line ranges.
 *
 * Example:
 * numberLineIntersection(listOf(1, 10), listOf(5, 15)) // [5, 10]
 * numberLineIntersection(listOf(-10, 0), listOf(0, 10)) // [0]
 * numberLineIntersection(listOf(-5, 5), listOf(-10, 10)) // [-5, 5]
 */
fun numberLineIntersection(range1: List<Int>, range2: List<Int>): List<Int> {

    // Check if there is any intersection at all
    if (range1[1] < range2[0] || range2[1] < range1[0]) {
        return emptyList()
    }

    // Get the intersection range
    return listOf(maxOf(range1[0], range2[0]), minOf(range1[1], range2[1]))
}
/**
 * Finds the intersection of two number line representations.
 *
 * @param range1 A list representing the first number line range.
 * @param range2 A list representing the second number line range.
 * @return A list representing the intersection of the two number line ranges.
 *
 * Example:
 * numberLineIntersection(listOf(1, 10), listOf(5, 15)) // [5, 10]
 * numberLineIntersection(listOf(-10, 0), listOf(0, 10)) // [0]
 * numberLineIntersection(listOf(-5, 5), listOf(-10, 10)) // [-5, 5]
 */
fun numberLineIntersection(range1: List<Int>, range2: List<Int>): List<Int> {
/**
 * Finds the intersection of two number line representations.
 *
 * @param range1 A list representing the first number line range.
 * @param range2 A list representing the second number line range.
 * @return A list representing the intersection of the two number line ranges.
 *
 * Example:
 * numberLineIntersection(listOf(1, 10), listOf(5, 15)) // [5, 10]
 * numberLineIntersection(listOf(-10, 0), listOf(0, 10)) // [0]
 * numberLineIntersection(listOf(-5, 5), listOf(-10, 10)) // [-5, 5]
 */
fun numberLineIntersection(range1: List<Int>, range2: List<Int>): List<Int> {

    // Check if there is any intersection at all
    if (range1[1] < range2[0] || range2[1] < range1[0]) {
        return emptyList()
    }

    // Get the intersection range
    return listOf(maxOf(range1[0], range2[0]), minOf(range1[1], range2[1]))
}