/**
 * Given a range of values and an array, create a tuple that contains only the values from the array that
 * fall within the range.
 *
 * @param rangeStart The start of the range.
 * @param rangeEnd The end of the range.
 * @param array The array containing values.
 * @return A tuple containing the values from the array that fall within the range.
 * @throws IllegalArgumentException If rangeStart is greater than rangeEnd.
 *
 * Example:
 * rangeStart = 1
 * rangeEnd = 5
 * array = listOf(1, 2, 3, 4, 5, 6, 7)
 * tupleFromRangeAndArray(rangeStart, rangeEnd, array) -> (1, 2, 3, 4, 5)
 */
fun tupleFromRangeAndArray(rangeStart: Int, rangeEnd: Int, array: List<Int>): List<Int> {

    if (rangeStart > rangeEnd) {
        throw IllegalArgumentException("rangeStart cannot be greater than rangeEnd")
    }

    val intersectingValues = array.filter { it in rangeStart..rangeEnd }
    return intersectingValues
}
/**
 * Given a range of values and an array, create a tuple that contains only the values from the array that
 * fall within the range.
 *
 * @param rangeStart The start of the range.
 * @param rangeEnd The end of the range.
 * @param array The array containing values.
 * @return A tuple containing the values from the array that fall within the range.
 * @throws IllegalArgumentException If rangeStart is greater than rangeEnd.
 *
 * Example:
 * rangeStart = 1
 * rangeEnd = 5
 * array = listOf(1, 2, 3, 4, 5, 6, 7)
 * tupleFromRangeAndArray(rangeStart, rangeEnd, array) -> (1, 2, 3, 4, 5)
 */
fun tupleFromRangeAndArray(rangeStart: Int, rangeEnd: Int, array: List<Int>): List<Int> {
/**
 * Given a range of values and an array, create a tuple that contains only the values from the array that
 * fall within the range.
 *
 * @param rangeStart The start of the range.
 * @param rangeEnd The end of the range.
 * @param array The array containing values.
 * @return A tuple containing the values from the array that fall within the range.
 * @throws IllegalArgumentException If rangeStart is greater than rangeEnd.
 *
 * Example:
 * rangeStart = 1
 * rangeEnd = 5
 * array = listOf(1, 2, 3, 4, 5, 6, 7)
 * tupleFromRangeAndArray(rangeStart, rangeEnd, array) -> (1, 2, 3, 4, 5)
 */
fun tupleFromRangeAndArray(rangeStart: Int, rangeEnd: Int, array: List<Int>): List<Int> {

    if (rangeStart > rangeEnd) {
        throw IllegalArgumentException("rangeStart cannot be greater than rangeEnd")
    }

    val intersectingValues = array.filter { it in rangeStart..rangeEnd }
    return intersectingValues
}