Second Largest Element
Easy 20 XPArrays
Commonly asked at Zoho, TCS, Amazon
Read a list of integers and print the second largest distinct value. If it does not exist, print -1.
- Input
- One line of space-separated integers.
- Output
- The second largest distinct value, or -1.
Sample 1
Input
12 35 1 10 34 1
Output
34
Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.The solution unlocks after 3 submissions.