Skip to content
CampusEduX

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.

Related Problems

  • Find the Largest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find the Smallest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Reverse an Array
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...