Second Largest in Array Problem

Second Largest in Array Problem — ExecCode School DSA Practice

Solve the Second Largest in Array problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a list of whole numbers. Your task is to solve Second Largest in Array. Find the second largest number and print it.

Examples

Input 5 1 2 3 4 5; Output 4. Input 5 5 4 3 2 1; Output 4

Constraints

1 <= n <= 10^5

Practice Second Largest in Array free on ExecCode. Browse DSA problems, topic map, and placement guides.