|Write a program to find the second largest number ...|General Coding Problems

fn second_largest(nums: &[i32]) -> i32

Medium

Write a program to find the second largest number in an array.

fn second_largest(nums: &[i32]) -> i32

Asked in

infosys

Examples

Example 1:
Input: [1,2,3,4,5]
Output: 4
Example 2:
Input: [10,5,8,12,3]
Output: 10
Submit Result

Click Run to test sample cases, or Submit to evaluate all cases