Difficulty : Easy Topics : Array, Sorting Platform : Leetcode Problem Statement Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number. Problem Statement Simplified Give back the 3rd largest number from the array if it exists, else give back the largest number. Mistakes and Learning Confusing over the array indexing and length—array indexing starts at 0 and length starts at 1, always forget that. Example 1 Input: nums = [3,2,1] Output: 1 Explanation: The first distinct maximum is 3. The second distinct maximum is 2. The third distinct maximum is 1. Enter fullscreen mode Exit fullscreen mode Example 2 Input: nums = [1,2] Output: 2 Explanation: The first distinct maximum is 2. The second distinct maximum is 1. The third distinct maximum does not exist, so the maximum (2) is returned instead. Enter fullscreen mode Exit fullscreen mode Key Insight Sort the array. Get the unique array.…