Bhai simple sa solution h, baaki angrez ke chode bhaut h idhar  
Intuitionsimple si approach h bhai pehle ek function bana liya jo ki saare elemnts jo ki nums array ke h us numbers ki sum of digit nikalega or us sum ko map me
# Intuition
simple si approach h bhai pehle ek function bana liya jo ki saare elemnts jo ki nums array ke h us numbers ki sum of digit nikalega or us sum ko map me as key store kiya h us particular ke saath jiska sum of digits h or fir check kiya ki map me koi already same key store h ki nhi agar h to ans ko ans = max(ans, map[x] + nums[i]); or agar nhi h to map[x] = max(map[x], nums[i]); ye isme max isliye use kiya kyuki ho skta h ki array mein same sum of digits wale multiple numbers hain, to unme se sabse zyada (maximum) number ko store karna hoga.

# Complexity
- Time complexity:
O(n*log(z))
the time complexity is n * log z because for each of the n elements, we are doing O(log z) work (due to the finddigit function).
- Space Complexity:
O(n)

# Code
```cpp []
class Solution {
public:
    int finddigit(int z)
    {
        int ans = 0;
        while(z > 0)
        {
            int temp = z % 10;
            ans = ans + temp;
            z = z/10;
        }
        return ans;
    }
    int maximumSum(vector<int>& nums) {
        int n = nums.size();
        int ans = -1;
        unordered_map<int, int> map;
        for(int i = 0; i < n; i++)
        {
            int x = finddigit(nums[i]);
            if(map.find(x) != map.end())
            {
                ans = max(ans, map[x] + nums[i]);
            }
            map[x] = max(map[x], nums[i]);
        }
        return ans;
    }
};
```
['C++']