The user will input an unsorted integer array and the method should find the third largest integer in the array.
- input: 3 ,6, 9, 8, 0
The user will input an unsorted integer array and the method should find the third largest integer in the array.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Aravind GovindarajPosted Nov 16, 2022, 10:57 PM
Pls follow the steps
1.get it as list
2. Sort it as descending using lambda
3. Then apply Skip(2).Take(1) => It will skip 0,1 index and take 2 index value.
4. Another option after skip apply firstordefaultvaule.
Both yield the same result
Jignesh KumarPosted Nov 16, 2022, 8:39 AM
Please check below one,
Vishal YelvePosted Nov 16, 2022, 7:27 AM
Try this
Amit MohantyPosted Nov 16, 2022, 6:21 AM
Try this
Uday DodiyaPosted Nov 16, 2022, 6:17 AM
Output :