# Sort Array

Posted: 1 Jan, 2021

Difficulty: Moderate

#### You are given an array consisting of 'N' positive integers where each integer is either 0 or 1 or 2. Your task is to sort the given array in non-decreasing order.

##### Note :

```
1. The array consists of only 3 distinct integers 0, 1, 2.
2. The array is non-empty.
```

##### Input Format :

```
The first line of the input contains an integer T denoting the number of test cases.
The first line of each test case contains an integer N, denoting the size of the array.
The second line of each test case contains N space-separated integers, representing the elements of the array.
```

##### Output Format :

```
The only line of output of each test case consists of N integers, denoting the sorted order of elements in the given array.
Print the output of each test case in a separate line.
```

##### Note :

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

##### Constraints :

```
1 <= T <= 100
1 <= N <= 10^4
0 <= arr[i] <= 2
where arr[i] is the array element at index 'i'.
Time Limit: 1 sec
```

SIMILAR PROBLEMS

City Lights

Posted: 9 Jul, 2022

Difficulty: Hard

Best time to buy and sell stock

Posted: 2 Sep, 2022

Difficulty: Moderate

Best time to buy and sell stock II

Posted: 5 Sep, 2022

Difficulty: Moderate

Array Rotation

Posted: 21 Oct, 2022

Difficulty: Easy

Find The Single Element

Posted: 30 Oct, 2022

Difficulty: Easy