+ 1
How to find the second largest number in an array??
Finding largest number is easy .. but how to print the second largest number??
4 Antworten
+ 7
Aditya Here you can find 3 different algorithm for that.
https://www.geeksforgeeks.org/find-second-largest-element-array/
+ 6
https://code.sololearn.com/cXMNp9k2lSL9/?ref=app
+ 3
https://www.sololearn.com/Discuss/1422750/?ref=app
var a=[1,3,2,4];
a.sort();
document.write(a[a.length-2]);
+ 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.