


Let ‘NUMARRAY’ = [-4, -2, 2, 5]. Here, only 'NUMARRAY[2]' = 2. So, our answer is 2.
If there is no such number present in 'NUMARRAY,’ which equals its index value, then return -1.
The first line of input contains an integer, 'T,’ which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains a single integer ‘N’.
The next line of each test case contains ‘N’ single space-separated integers denoting the numbers in ‘NUMARRAY.’.
For each test case, print all the numbers which satisfy the given condition.
Print the output of each test case in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 100
0 <= ‘N’ <= 5000
-5000 <= ‘NUMARRAY[i]’ <= 5000
Where 'T' denotes the number of test cases.
‘N’ is the number of elements in the array/list ‘NUMARRAY’.
Time Limit: 1 second
We can simply iterate through the array for all the indices. If we find the number which is equal to its index value in ‘NUMARRAY’, we add this number into our answer.
Here is the algorithm :