Python3 || 6 lines, dict(heaps) ||  T/S: 57% / 69%
https://leetcode.com/problems/max-sum-of-a-pair-with-equal-sum-of-digits/submissions/1287323201/I could be wrong, but I think that time complexity is O(N log N)
```Python3 []
class Solution:
    def maximumSum(self, nums: List[int]) -> int:

        d = defaultdict(lambda: [0, 0])

        digSum = lambda x: sum(map(int, str(x)))
       
        for n in nums:
            heappushpop(d[digSum(n)], n)

        sums = [sum(pair) for pair in d.values()
                                 if 0 not in pair]  

        return max(sums, default = -1)
```
[https://leetcode.com/problems/max-sum-of-a-pair-with-equal-sum-of-digits/submissions/1287323201/](https://leetcode.com/problems/max-sum-of-a-pair-with-equal-sum-of-digits/submissions/1287323201/)

I could be wrong, but I think that time complexity is *O*(*N* log *N*) and space complexity is *O*(*N*), in which *N* ~ `len(nums)`.

['Python3']