Second Largest (Distinct)

JavaScript Easy 4 views
Back to Questions

Problem Description

Find the second largest distinct value in the array. If it does not exist, print -1.

Input Format

One line: n then n integers.

Output Format

One integer answer.

Sample Test Case

Input:
6 5 1 5 3 4 4
Output:
4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next