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

You are given an integer array nums. You have to find the maximum sum of a pair of numbers from nums such that the largest digit in both numbers is equal.
For example, 2373 is made up of three distinct digits: 2, 3, and 7, where 7 is the largest among them.
Return the maximum sum or -1 if no such pair exists.
 
Please complete the following python code precisely:
```python
class Solution:
    def maxSum(self, nums: List[int]) -> int:
```