#K3646. Minimum Numeric Key
Minimum Numeric Key
Minimum Numeric Key
Rick found himself in front of a treasure chest secured by a combination lock. The lock can be opened by providing the minimum possible numeric key that contains all the digits present in the lock combination. Although Rick is allowed to insert an arbitrary number of 0's between these digits, no 0 is permitted at the beginning of the key.
The optimal strategy is to sort the given digits in non-decreasing order and combine them to form the key.
Mathematically, if the lock combination has digits \(a_1, a_2, \dots, a_n\), then the solution is to output \(\text{sort}(a_1, a_2, \dots, a_n)\) as a concatenated number.
inputFormat
The input is provided via standard input (stdin). The first line contains an integer \(t\) denoting the number of test cases. Each test case is described in two lines:
- The first line contains an integer \(n\), the number of digits in the combination.
- The second line contains \(n\) space-separated integers (each in the range 1 to 9), representing the digits of the lock combination.
outputFormat
For each test case, output the minimum possible numeric key on a new line. The key is formed by sorting the provided digits in non-decreasing order (inserting 0's is allowed only in between if needed, but is not necessary when sorting is optimal).
## sample1
5
3 1 4 1 5
11345
</p>