/**
 * Given the start and end positions of two number lines, this function finds the intersection of the two segments.
 *
 * @param start1 The starting position of the first number line segment
 * @param end1 The ending position of the first number line segment
 * @param start2 The starting position of the second number line segment
 * @param end2 The ending position of the second number line segment
 * @return A list containing the common positions between the two number line segments
 */
fun nestedLoopIntersection(start1: Int, end1: Int, start2: Int, end2: Int): List<Int> {

    val intersection = mutableListOf<Int>()

    // Nested loops to iterate over the number line segments
    for (i in start1..end1) {
        for (j in start2..end2) {
            // Check if the two positions intersect
            if (i == j) {
                intersection.add(i)
            }
        }
    }

    return intersection
}
/**
 * Given the start and end positions of two number lines, this function finds the intersection of the two segments.
 *
 * @param start1 The starting position of the first number line segment
 * @param end1 The ending position of the first number line segment
 * @param start2 The starting position of the second number line segment
 * @param end2 The ending position of the second number line segment
 * @return A list containing the common positions between the two number line segments
 */
fun nestedLoopIntersection(start1: Int, end1: Int, start2: Int, end2: Int): List<Int> {
/**
 * Given the start and end positions of two number lines, this function finds the intersection of the two segments.
 *
 * @param start1 The starting position of the first number line segment
 * @param end1 The ending position of the first number line segment
 * @param start2 The starting position of the second number line segment
 * @param end2 The ending position of the second number line segment
 * @return A list containing the common positions between the two number line segments
 */
fun nestedLoopIntersection(start1: Int, end1: Int, start2: Int, end2: Int): List<Int> {

    val intersection = mutableListOf<Int>()

    // Nested loops to iterate over the number line segments
    for (i in start1..end1) {
        for (j in start2..end2) {
            // Check if the two positions intersect
            if (i == j) {
                intersection.add(i)
            }
        }
    }

    return intersection
}