问题:https://leetcode.com/problems/third-maximum-number/
Given a non-empty array of integers, returnthe third maximum number in this array. If it does not exist, return themaximum number. The time complexity must be in O(n).返回第三大的元素。
思考:现将数组进行排序,从最大值开始,依次比较,返回第三大的元素。
代码: