Java Solution Accepted
\nclass Solution {\n    public int maximumSum(int[] nums) {\n        HashMap<Integer,PriorityQueue<Integer>> map = new HashMap<>();\n        for(int i : nums){\
```\nclass Solution {\n    public int maximumSum(int[] nums) {\n        HashMap<Integer,PriorityQueue<Integer>> map = new HashMap<>();\n        for(int i : nums){\n            int s = dSum(i);\n            map.putIfAbsent(s,new PriorityQueue<>((n1,n2)->n2-n1));\n            map.get(s).add(i);\n        }\n        \n        int max = -1;\n        for(int i:nums){\n            int s = dSum(i);\n            PriorityQueue<Integer> pq = map.get(s);\n            if(pq.size() > 1){\n                max = Math.max(max,pq.poll()+pq.poll());\n            }\n        }\n        \n        return max;\n    }\n    \n    public int dSum(int val){\n        int sum = 0;\n        while(val > 0){\n            sum += val%10;\n            val = val/10;\n        }\n        return sum;\n    }\n}\n```
['Heap (Priority Queue)']