LeetCode 414 Third Maximum Number

Given a non-empty integer array, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number in the array. Example 1: Input: [3, 2, 1] Output: 1 Explanation: The third distinct maximum is 1. Example 2: Input: [1, 2] Output: 2 Explanation: The third distinct maximum does not exist, so t ...

Posted on Thu, 27 Aug 2026 16:20:00 +0000 by nepzap2