Please solve the programming task below using a self-contained code snippet in a markdown code block.

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.
 
Please complete the following python code precisely:
```python
class Solution:
    def thirdMax(self, nums: List[int]) -> int:
```