难度: easy
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).
思路:找出list中第三大的数,用set()消除掉list中的重复序列,然后再用sort()排序。
难度: easy
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).
思路:找出list中第三大的数,用set()消除掉list中的重复序列,然后再用sort()排序。