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: 1 Explanation: The third maximum is 1. Examp…
public class Solution { public int ThirdMax(int[] nums) { ; var list = nums.Distinct().OrderByDescending(x => x).ToList(); ) { third = ; } && list.Count <= ) { third = list[]; } else { third = list[]; } return third; } } https://leetcode.com…