Third greatest element
Given an array/list 'ARR' of ‘N’ distinct integers, you are supposed to find the third largest element in the given array 'ARR'.
Input Format :
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'.
Output Format :
For each test case, print the third largest element in the given array/list 'ARR'.
Note :
You don’t need to print anything; It has already been taken care of. Just implement the given function.
Constraints :
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
Be the first one to answer
Add answer anonymously...
Top Virtusa Consulting Services Full Stack Developer interview questions & answers
Popular interview questions of Full Stack Developer
Top HR questions asked in Virtusa Consulting Services Full Stack Developer
>
Virtusa Consulting Services Full Stack Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app