are you looking for answer of how to find the second largest number in any array in JavaScript?
In this video i have explained 3 ways you can find the second largest number in any array in JavaScript, and also given their time complexity.
The first method involves sorting whose time complexity is O(nlogn)
The second method involves two for loop whose time complexity is O(n)
The second method involves just one for loop whose time complexity is also O(n)
Top comments (0)