nums:
a. For each number, convert it to a string and find the maximum digit.
b. Add the number to the corresponding list in the HashMap using the maximum digit as the key.maxSum to store the maximum pair sum found, initially set to -1.maxSum with the maximum of its current value and the calculated sum.maxSum if it's greater than -1, otherwise return -1.