LeetCode-Third Maximum Number
2016-10-23 21:26
363 查看
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).
Example 1:
Example 2:
Example 3:
Example 1:
Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1.
Example 2:
Input: [1, 2] Output: 2 Explanation: The third maximum does not exist, so the maximum (2) is returned instead.
Example 3:
Input: [2, 2, 3, 1] Output: 1 Explanation: Note that the third maximum here means the third maximum distinct number. Both numbers with value 2 are both considered as second maximum.
相关文章推荐
- leetcode[Third Maximum Number]
- LeetCode刷题(Third Maximum Number )
- LeetCode_414 Third Maximum Number(easy)
- Leetcode 414:Third Maximum Number
- LeetCode 414 --- Third Maximum Number
- [LeetCode] Third Maximum Number 第三大的数
- LeetCode414——Third Maximum Number
- LeetCode Third Maximum Number
- leetcode_Third Maximum Number
- leetcode Third Maximum Number 第三大的数
- LeetCode Third Maximum Number
- leetcode414: Third Maximum Number
- LeetCode 414 Third Maximum Number(set + priority_queue)
- [C语言][LeetCode][414]Third Maximum Number
- Leetcode Third Maximum Number 414
- 【LeetCode-414】Third Maximum Number(C++)
- [LeetCode]414 Third Maximum Number
- LeetCode---414---ThirdMaximumNumber
- LeetCode-Easy部分中标签为Array#414 : Third Maximum Number
- leetcode414~Third Maximum Number