Beats-100% | Python| Solved using List of Tuples | MOST Easy😊😊
ApproachList of Tuples used in python for implemetation.Complexity
Time complexity: O(nlogn)

Space complexity: O(n)
CodeSMALL REQUEST : If you found this post
# Approach
<!-- Describe your approach to solving the problem. -->
List of Tuples used in python for implemetation.
# Complexity
- Time complexity: $$O(nlogn)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(n)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def maximumSum(self, nums: List[int]) -> int:
        def digit_sum(i):
            s = 0
            while(i):
                s += i%10
                i //= 10
            return s
        pairs = []
        for n in nums:
            s = digit_sum(n)
            pairs.append((s,n))
        pairs.sort()
        max_sum = -1
        for i in range(1,len(nums)):
            if pairs[i][0] == pairs[i-1][0]:
                cur_sum = pairs[i][1]+pairs[i-1][1]
                max_sum = max(max_sum, cur_sum)
        return max_sum     
```
# SMALL REQUEST : If you found this post even remotely helpful, be kind enough to smash a upvote. I will be grateful.I will be motivated😊😊
['Python3']