C++ solution | easy | using maps
\nint maximumSum(vector<int>& nums){\n\tunordered_map<int, vector<int> > umap;\n\tfor(int i=0; i<nums.size(); i++){\n\t\tint l =0, n= nums[i];\n\t\twhile(n){\n\
```\nint maximumSum(vector<int>& nums){\n\tunordered_map<int, vector<int> > umap;\n\tfor(int i=0; i<nums.size(); i++){\n\t\tint l =0, n= nums[i];\n\t\twhile(n){\n\t\t\tl+=(n%10);\n\t\t\tn = n/10;\n\t\t}\n\t\tumap[l].push_back(nums[i]);            \n\t}\n\tint sum=-1;\n\tfor(auto i: umap){\n\t\tif(i.second.size()!=1){\n\t\t\tint s;\n\t\t\tsort(i.second.begin(), i.second.end(), greater<int>());\n\t\t\ts= i.second[0] + i.second[1];\n\t\t\tsum = max(sum, s);\n\t\t}\n\t}\n\treturn sum;\n}\n```\n
[]