c++ easy solution
```\nclass Solution {\npublic:\n    int dsum(int n)\n    {\n        int sum=0;\n        while(n!=0)\n        {\n            sum += n%10;\n            n=n/10;\n 
```\nclass Solution {\npublic:\n    int dsum(int n)\n    {\n        int sum=0;\n        while(n!=0)\n        {\n            sum += n%10;\n            n=n/10;\n        }\n        return sum;\n    }\n    int maximumSum(vector<int>& nums) {\n        unordered_map <int,int> mp;\n        int ans=-1;\n        for(int i =0;i<nums.size();i++)\n        {\n            int temp = dsum(nums[i]);\n            if(mp.find(temp)!=mp.end())\n            {\n                int t = mp[temp]+nums[i];\n                if(mp[temp]<nums[i])\n                    mp[temp]=nums[i];\n                ans = max(ans,t);\n            }\n            else\n            {\n                mp.insert({temp,nums[i]});\n            }\n        }\n        return ans;\n        \n    }\n};
[]