/**
 * Given a list of numbers 'nums`, a lower bound 'lower`, and an upper bound 'upper`,
 * find the intersection between the range from 'lower" to 'upper" (inclusive)
 * and the list of numbers 'nums`.
 *
 * @param nums: A list of numbers
 * @param lower: The lower bound of the range
 * @param upper: The upper bound of the range
 * @return A list containing the numbers from 'nums" that fall within the specified range
 *
 * Example:
 * intersectionOfExamplesAndRangeWithNegativeValues([-2, -1, 0, 1, 2, 3, 4, 5], -2, 2)
 * Output: [-2, -1, 0, 1, 2]
 */
fun intersectionOfExamplesAndRangeWithNegativeValues(nums: List<Int>, lower: Int, upper: Int): List<Int> {

    val intersection = mutableListOf<Int>()
  
    for (num in nums) {
        if (lower <= num && num <= upper) {
            intersection.add(num)
        }
    }
  
    return intersection
}
/**
 * Given a list of numbers 'nums`, a lower bound 'lower`, and an upper bound 'upper`,
 * find the intersection between the range from 'lower" to 'upper" (inclusive)
 * and the list of numbers 'nums`.
 *
 * @param nums: A list of numbers
 * @param lower: The lower bound of the range
 * @param upper: The upper bound of the range
 * @return A list containing the numbers from 'nums" that fall within the specified range
 *
 * Example:
 * intersectionOfExamplesAndRangeWithNegativeValues([-2, -1, 0, 1, 2, 3, 4, 5], -2, 2)
 * Output: [-2, -1, 0, 1, 2]
 */
fun intersectionOfExamplesAndRangeWithNegativeValues(nums: List<Int>, lower: Int, upper: Int): List<Int> {
/**
 * Given a list of numbers 'nums`, a lower bound 'lower`, and an upper bound 'upper`,
 * find the intersection between the range from 'lower" to 'upper" (inclusive)
 * and the list of numbers 'nums`.
 *
 * @param nums: A list of numbers
 * @param lower: The lower bound of the range
 * @param upper: The upper bound of the range
 * @return A list containing the numbers from 'nums" that fall within the specified range
 *
 * Example:
 * intersectionOfExamplesAndRangeWithNegativeValues([-2, -1, 0, 1, 2, 3, 4, 5], -2, 2)
 * Output: [-2, -1, 0, 1, 2]
 */
fun intersectionOfExamplesAndRangeWithNegativeValues(nums: List<Int>, lower: Int, upper: Int): List<Int> {

    val intersection = mutableListOf<Int>()
  
    for (num in nums) {
        if (lower <= num && num <= upper) {
            intersection.add(num)
        }
    }
  
    return intersection
}