


The first line contains a single integer ‘T’ denoting the number of test cases. The test cases follow.
The first line of each test case contains a single integer ‘N’ denoting the number of elements in the array/list.
The second line of each test case contains ‘N’ single space-separated distinct integers denoting the elements of 'ARR'.
For each test case, print the third largest element in the given array/list 'ARR'.
You don’t need to print anything; It has already been taken care of. Just implement the given function.
1 <= T <= 50
3 <= N <= 10^4
-10^5 <= ARR[i] <= 10^5
Where 'ARR[i]' denotes the i-th elements of the given array/list.
Time Limit: 1 sec
The idea is to sort the array in non-decreasing order, and then return the third element from the back of the array.
The steps are as follows :
The idea is to iterate through the array and find the largest element and the second-largest elements in the given array/list and then again iterate to find the third largest element in the given array/list.
The steps are as follows :
Return “MAXTHREE”.
The idea is to iterate through the array only once and keep track of the largest element, second largest, and the third-largest element simultaneously.
The steps are as follows :
Return “MAXTHREE”.