Skip to content

Latest commit

 

History

History

find_second_largest

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given an array of elements. Your task is to find the second maximum element in the array.

Example 1:

Input: N=5 arr[] = { 2, 4, 5, 6, 7 } Output: 6 Explanation: The largest element is 7 and the second largest element is 6.

Example 2:

Input: N=6 arr[] = { 7, 8, 2, 1, 4, 3 } Output: 7