Easy
Given an integer array nums, return the third distinct maximum value. If it does not exist, return the maximum value.
nums
Input: nums = [3,2,1] Output: 1
Input: nums = [1,2] Output: 2
Input: nums = [2,2,3,1] Output: 1