JavaMediumArrays15 min

Second largest number in an array

Find the second largest distinct value in {12, 45, 45, 3, 78, 9}.

Example

Input

—

Output

—
Hints (1)
  1. Single pass with two variables, or distinct().sorted().skip(1) with Streams.

Your solution

Checking runner availability…

Reference solution

Sign in for solution
All Java programs