Skip to content
C

Find the Second Largest Element

Easyjavapythonccppjavascript

Given an array that contains at least two different values, find the second largest distinct element.

Input Format

The first line contains an integer N. The second line contains N space-separated integers. At least two distinct values are present.

Output Format

Print the second largest distinct element.

Input (stdin)

Output

Run your code to see output here...