All problems
MediumLists
Second-largest element
Return the second-largest unique value in a list. Assume at least 2 unique values.
- #lists
- #sort
Sample input
[5, 1, 4, 2, 5, 3]
Sample output
4
second-largest.py
Output
Press "Run code" to execute.
Return the second-largest unique value in a list. Assume at least 2 unique values.
[5, 1, 4, 2, 5, 3]
4
Press "Run code" to execute.
Admissions open · free to apply
Attended a masterclass or have a friend's referral code? You get ₹15,000 off. Fill this and our team takes it from here — pay by cash or online.
Free to apply · masterclass attendees & referrals get ₹15,000 off · our team guides you next.
By submitting, you agree to our Privacy Policy and to be contacted about your enquiry.