
12345 satisfies the condition since it has all ‘1’, ‘2’, and ‘3’ in its digits, but 124 doesn’t satisfy the condition since it only has ‘1’ and ‘2’ but not ‘3’ in its digits.
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, the number of elements in the array.
The next line of each test case contains N space-separated integers, denoting the array elements.
For every test case, the only output line contains an array containing the elements with ‘1’,’2’, and ‘3’ in their digits in ascending order.
You do not need to print anything; it has already been taken care of. Just implement the given function.
You have to return an array containing elements with ‘1’,’2’, and ‘3’ in their digits in ascending order. If there is no such element containing ‘1’, ‘2’, and ‘3’ in its digits, return an empty array.
1 <= T <= 5
1 <= N <= 10^5
1 <= arr[i] <= 10^9
Time limit: 1 sec
We will create an “answer” array to store the elements with ‘1’, ‘2’, and ‘3’ in their digits. For all the array elements, we will check if the element contains ‘1’, ‘2’, and ‘3’, and if this condition is true, then we will push this element into our answer array.