算法-Array
来源:互联网 发布:预约抢号软件 编辑:程序博客网 时间:2024/06/05 10:49
Difficulty:Easy
414. Third Maximum Number
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:
Input: [3, 2, 1]Output: 1Explanation: The third maximum is 1.
Example 2:
Input: [1, 2]Output: 2Explanation: The third maximum does not exist, so the maximum (2) is returned instead.
Example 3:
Input: [2, 2, 3, 1]Output: 1Explanation: Note that the third maximum here means the third maximum distinct number.Both numbers with value 2 are both considered as second maximum.
0 0
- 算法-Array
- 算法 Merge Sorted Array
- 【Leetcode算法】- Rotate Array
- 算法:Merge Sorted Array
- 算法-array-6-ReshapetheMatrix
- 算法<Array Partition I>
- 【算法】【Greedy】Patching Array
- array, vector 排序算法(1)
- array, vector 排序算法 2
- double-array trie算法实现
- Merge Sorted Array算法详解
- Array的一些排序算法
- codewars算法题-Array.diff
- 算法题-Array random element
- 洗牌算法-Shuffle an Array
- 2017 icpc 沈阳赛区 1004.array array array(最长序列nlogn算法)
- hdu-6197 array array array(最长上升子序列(LIS)长度的O(nlogn)算法)
- 关于Manber-Mayer suffix array 构造算法
- springMVC笔记系列(22)——Json各类操作在springMVC中的实现
- 广播的最佳实践——实现强制下线功能
- 数据标准差的计算
- MQTT的一些常用术语(帮助理解)
- UEFI - 启动
- 算法-Array
- FreeRTOS 学习总结(一)
- window 和document常见的方法和属性
- 1014. 福尔摩斯的约会
- Qt:事件过滤器详解
- 我的硕士学习生活中期小总结
- C语言知识点
- C语言实现粒子群算法(PSO)二
- 全国等级保护测评机构推荐目录