 Maximum value K
##### Submissions: 976   Accuracy: 26.28%   Difficulty: Easy   Marks: 2

Given an array of positive integers, Your task is to  find maximum possible value K such that the array has at-least K elements that are greater than or equal to K.
Note: The array is unsorted and may contain duplicate values.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow.
The first line of each test case contains a positve integer N, denoting the length of the array A[ ].
The second line of each test case contains a N space seprated positve integers, denoting the elements of the array A[ ].

Output:
Print the maximum possible value K.

Constraints:
1 <= T <= 100
2 <= N <=30
0 <= A[ ] <= 100

Example:

Input
2
6
2 3 4 5 6 7
4
1 2 3 4

Output
4
2

Explanation

In the first test case for the arrray [2, 3, 4, 5, 6, 7] 4 elements [4, 5, 6, 7] which are greater than equal to 4 hence 4 is output .

In the second test case for the array [1,2,3,4] there are 3 elements [2, 3, 4] which are greater than equal to 2 hence 2 is output .

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: Shubham Joshi 1

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.