C++ | easy solution| 100% faster | vector pair
please upvote if you like the solution\n\n\nclass Solution {\npublic:\n\n    int maximumSum(vector& nums) {\n        int n = nums.size();\n        vector v;\n  
#### please upvote if you like the solution\n![image](https://assets.leetcode.com/users/images/c9def8a0-a463-4c35-b487-6c81583d9f8a_1658032168.6277628.png)\n\nclass Solution {\npublic:\n\n    int maximumSum(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> v;\n        int ans=-1;\n        vector<pair<int,int>> p;\n        for( int i=0;i<n ;i++){ \n            int a=0, sum=0;\n            a=nums[i]; \n             while (a != 0) {\n                sum = sum + a % 10;\n                 a = a / 10;\n            }\n           \n            v.push_back(sum);\n        }\n        for(int i=0 ;i<n;i++){\n            p.push_back(make_pair(v[i], nums[i]));\n        }\n        sort(p.begin(),p.end());\n          \n             for(int i=1;i<n ;i++){\n                 if(p[i].first == p[i-1].first){\n                     ans=max(ans,p[i].second+p[i-1].second);\n                 }\n             }\n        return ans;\n    }\n};\n
['C', 'C++']