✅ Two Simple Lines of Code
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)Code #1 - Three LinesTime complexity: O(n). Space co
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)

# Code #1 - Three Lines
Time complexity: $$O(n)$$. Space complexity: $$O(n)$$.
```python3
class Solution:
    def maximumSum(self, a: List[int]) -> int:
        d = defaultdict(list)
        [d[sum(map(int,str(v)))].append(v) for v in a]
        return max([sum(nlargest(2,w+[-inf])) for w in d.values()]+[-1])
```

# Code #2 - Two Lines
Time complexity: $$O(n*log(n))$$. Space complexity: $$O(n)$$.
```python3
class Solution:
    def maximumSum(self, a: List[int]) -> int:
        f = lambda v: sum(map(int,str(v)))
        return max([sum(nlargest(2,[*p,-inf])) for _,p in groupby(sorted(a,key=f),f)]+[-1])
```

(Disclaimer 2: code above is just a product of fantasy packed into one line, it is not declared to be 'true' oneliners - please, remind about drawbacks only if you know how to make it better)
['Array', 'Hash Table', 'Sorting', 'Heap (Priority Queue)', 'Python', 'Python3']