Find 2nd largest number in an array of integers
Anonymous
First need to sort out the array using inbuild function or write any sorting algorithm like Bubble, Quick or Merge, whatever algo seems more efficient then just set the index 2 to get the second largest. Below is a simple javascript solution getSecondLargest(arr, len) { return len b - a)[1]; }
Check out your Company Bowl for anonymous work chats.