fb pixel

Double sorting

Given n numbers, you are asked to perform double sorting. Double sorting can be described as first sorting all the digits of a number in increasing order, and afterward sorting the whole list of numbers in the increasing order.
The first line of the input contains the number n, which is followed by the second line which contains space-separated n numbers.
The output of the program should contain the resulting list of numbers after double sorting.
Input
5
34 65 99 10 22

Output
1 22 34 56 99
 
To check your solution you need to sign in
Sign in to continue