C++ 🔥🔥||🔥🔥 EASY TO UNDERSTAND 🔥🔥||🔥🔥 VECTOR 🔥🔥||🔥🔥 O(N)🔥🔥
IntuitionC++ 🔥🔥||🔥🔥 EASY TO UNDERSTAND 🔥🔥||🔥🔥 VECTOR 🔥🔥||🔥🔥 O(N)🔥🔥Approachmake an array of same sum of digit number. and in question they mention pair so find 2
# Intuition
C++ 🔥🔥||🔥🔥 EASY TO UNDERSTAND 🔥🔥||🔥🔥 VECTOR 🔥🔥||🔥🔥 O(N)🔥🔥

# Approach
make an array of same sum of digit number. and in question they mention pair so find 2 largest number and check if sum is more than answer then update it

# Complexity
- Time complexity:
O(n)

- Space complexity:
O(n)

# Code
```cpp []
class Solution {
public:
    int maximumSum(vector<int>& nums) {
        
        vector<vector<int>> digit_sum(100 , vector<int>());

        // O(n) time require to arrange number in digit_sum vector
        for(int i = 0 ; i< nums.size() ; i++){
            int temp_sum = 0;
            int num = nums[i];
            while(num!=0){
                temp_sum+=(num%10);
                num/=10;
            }
            digit_sum[temp_sum].push_back(nums[i]);
        }

        int ans = -1;
        for(int i = 0 ; i< 100 ; i++){

            // if vector size more than two than find largest 2 number in O(n) time
            if(digit_sum[i].size() >=2){
                int l1,l2;
                if(digit_sum[i][0]>digit_sum[i][1]){
                    l1 = digit_sum[i][0];
                    l2 = digit_sum[i][1];
                }else{
                    l2 = digit_sum[i][0];
                    l1 = digit_sum[i][1];
                }

                for(int j = 2 ; j<digit_sum[i].size() ; j++){
                    if(digit_sum[i][j]>=l1){
                        l2 = l1;
                        l1 = digit_sum[i][j];
                    }else if(digit_sum[i][j]<l1 && digit_sum[i][j]>l2){
                        l2 = digit_sum[i][j];
                    }
                }

                // choose largest between them
                ans = max(ans , l1+l2);

            }
        }

        return ans;

    }
};
```
['C++']