Given an array A of size N containing 0s, 1s, and 2s; you need to sort the array in ascending order.
The first line contains an integer 'T' denoting the total number of test cases. Then T testcases follow. Each testcases contains two lines of input. The first line denotes the size of the array N. The second lines contains the elements of the array A separated by spaces.
For each testcase, print the sorted array.
1 <= T <= 500
1 <= N <= 106
0 <= Ai <= 2
0 2 1 2 0
0 1 0
0 0 1 2 2
0 0 1
Testcase 1: After segragating the 0s, 1s and 2s, we have 0 0 1 2 2 which shown in the output.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.