+ 1

How to find the second largest number in an array??

Finding largest number is easy .. but how to print the second largest number??

23rd Nov 2020, 2:27 PM
Vishnu Aditya
Vishnu Aditya - avatar
4 Respostas
+ 7
Aditya Here you can find 3 different algorithm for that. https://www.geeksforgeeks.org/find-second-largest-element-array/
23rd Nov 2020, 3:00 PM
Minho
Minho - avatar
+ 6
https://code.sololearn.com/cXMNp9k2lSL9/?ref=app
23rd Nov 2020, 3:10 PM
Gordon
Gordon - avatar
+ 3
https://www.sololearn.com/Discuss/1422750/?ref=app var a=[1,3,2,4]; a.sort(); document.write(a[a.length-2]);
23rd Nov 2020, 2:46 PM
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜
˜”*°‱.˜”*°‱ Mohan 333 ‱°*”˜.‱°*”˜ - avatar
+ 1
Thank you Gordon, Can you suggest me anther method where we donot know the array of numbers that are passed inside but the array of numbers are greater than 0 and integers.
24th Nov 2020, 1:52 AM
Vishnu Aditya
Vishnu Aditya - avatar