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
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.