Since there is no duplicates:
-
Sort an array
-
Use those sorted indexes to enumerate each value in the input
-
Get median value like the QS algo and make "buckets" and sort each bucket
-
Optimize the output string, merge subsequent sa sb and replace by ss for exemple.
-
Check if a number is correct (-3 +1 0 INT_MAX INT_MIN 01 003 for exemple)