Search
⌘K
Get Premium
Leetcode 414. Third Maximum Number
Return the third distinct largest value in an integer array (treat duplicate values as one); if fewer than three distinct values exist, return the maximum. The challenge is to do this in O(n) time (ideally with constant extra space).
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late February, 2025
Meta
Senior
You can swap two digits at most once to get the maximum valued number
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.