Dsa
Arrays
Warm-up
Find Second Largest
You are given an array of integers. Your task is to find the second largest unique number in the array. If there is no second largest number (for example, when all numbers are the same), return -1.
Input format:
- A single line containing space-separated integers.
Output format:
- A single integer representing the second largest unique number, or -1 if it does not exist.
Example:
Input:
3 1 4 4 2 3
Output:
3
Key concepts
arrayssearching
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now