/**
 * Given a list of integers 'numbers', representing points on a number line and two integers 'lower' and 'upper',
 * find all the numbers that lie within the closed interval [lower, upper] on the number line.
 *
 * @param numbers A list of integers representing points on the number line.
 * @param lower An integer representing the lower bound of the closed interval.
 * @param upper An integer representing the upper bound of the closed interval.
 * @return A list of integers, containing numbers that lie within the closed interval [lower, upper], sorted in ascending order.
 */
fun findIntersection(numbers: List<Int>, lower: Int, upper: Int): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through each number in the list
    for (num in numbers) {
        // Check if the number lies within the closed interval [lower, upper]
        if (num in lower..upper) {
            // Add the number to the result list
            result.add(num)
        }
    }

    // Sort the result list in ascending order
    result.sort()

    return result
}
/**
 * Given a list of integers 'numbers', representing points on a number line and two integers 'lower' and 'upper',
 * find all the numbers that lie within the closed interval [lower, upper] on the number line.
 *
 * @param numbers A list of integers representing points on the number line.
 * @param lower An integer representing the lower bound of the closed interval.
 * @param upper An integer representing the upper bound of the closed interval.
 * @return A list of integers, containing numbers that lie within the closed interval [lower, upper], sorted in ascending order.
 */
fun findIntersection(numbers: List<Int>, lower: Int, upper: Int): List<Int> {
/**
 * Given a list of integers 'numbers', representing points on a number line and two integers 'lower' and 'upper',
 * find all the numbers that lie within the closed interval [lower, upper] on the number line.
 *
 * @param numbers A list of integers representing points on the number line.
 * @param lower An integer representing the lower bound of the closed interval.
 * @param upper An integer representing the upper bound of the closed interval.
 * @return A list of integers, containing numbers that lie within the closed interval [lower, upper], sorted in ascending order.
 */
fun findIntersection(numbers: List<Int>, lower: Int, upper: Int): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through each number in the list
    for (num in numbers) {
        // Check if the number lies within the closed interval [lower, upper]
        if (num in lower..upper) {
            // Add the number to the result list
            result.add(num)
        }
    }

    // Sort the result list in ascending order
    result.sort()

    return result
}