#C12180. Filter and Sort Integers Within a Range
Filter and Sort Integers Within a Range
Filter and Sort Integers Within a Range
Given a list of integers and two bounds \(min\_val\) and \(max\_val\) (inclusive), your task is to filter the integers that lie within this range and then output the resulting list in ascending order.
In other words, you need to extract all integers \(x\) such that \(min\_val \leq x \leq max\_val\), sort them, and print them as a space-separated list. If there are no integers that satisfy the condition, print an empty line.
inputFormat
The input consists of three lines:
- The first line contains a single integer \(n\) representing the number of elements in the list.
- The second line contains \(n\) space-separated integers.
- The third line contains two space-separated integers: \(min\_val\) and \(max\_val\), defining the inclusive bounds.
outputFormat
Output the filtered and sorted integers as a space-separated single line. If no numbers match the criteria, output an empty line.
## sample5
1 2 3 4 5
2 4
2 3 4
</p>