Problem: https://www.codechef.com/PBK12020/problems/ITGUY14

# DIFFICULTY:

EASY.

# PROBLEM:

The chef is having one array of N natural numbers(numbers may be repeated). i.e. All natural numbers must be less than N. Chef wants to rearrange the array and try to place a natural number on its index of the array, i.e array[i]=i. If multiple natural numbers are found for given index place one natural number to its index and ignore others.i.e. arr[i]=i and multiple i found in array ignore all remaining iās If any index in the array is empty place 0 at that place. i.e. if for arr[i], i is not present do arr[i]=0.

# Program:

#include <bits/stdc++.h>

using namespace std;

int main()

{

ios_base::sync_with_stdio(false);

cin.tie(0);

cout.tie(0);

```
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector arr(n, 0);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
arr[x] = x;
}
for (int i : arr)
cout << i << " ";
cout << endl;
}
return 0;
```

}