188. Sort a Queue
Core1000 ms256 MBSolved by 0%
Read n values added to a queue in the order given, sort them into
ascending order, and print the queue from front to back.
Constraints - `1 ≤ n ≤ 200000` - `-1000000 ≤ value ≤ 1000000`
Input
The first line contains an integer n.
The second line contains n space-separated integers, in the order they are added.
Output
Print n integers on ONE line, separated by single spaces — the values in ascending order.
Input5
4 2 1 5 3
Output1 2 3 4 5
Noteis a scrambled queue
Input1
7
Output7
Noteis a single value
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution