Scala Programming: Find the second largest element in an array
Write a Scala program to find the second largest element from a given array of integers.
Sample Solution:
Scala Code:
Sample Output:
Orginal array: 10789, 2035, 1899, 1456, 2013, 1458, 2458, 1254, 1472, 2365, 1456, 2165, 1457, 2456, Second largest value of the said array: 2458
Scala Code Editor :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Scala program to remove duplicate elements from an array of integers.
Next: Write a Scala program to find the second smallest element from a given array of integers.
What is the difficulty level of this exercise?
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics