JAVA || EASY TO UNDERSTAND 🚀 ✅|| USING HASHMAP😎 || BRUTE FORCE LOGIC💯🌟🌟🌟
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int maximumSum(int[] arr) {
        HashMap<Integer, Integer> map =  new HashMap<>();
		int max = -1;
		
		for(int i = 0; i < arr.length; i++)
		{
			int sum = 0;
			int n = arr[i];
			while(n > 0)
			{
				sum += n % 10;
				n /= 10;
			}
			if(map.get(sum) == null)
			{
				map.put(sum, arr[i]);
			}
			else if(map.get(sum) < arr[i])
			{	
				max = Math.max(arr[i] + map.get(sum), max);
				map.put(sum, arr[i]);
			}
			else
			{
				max = Math.max(arr[i] + map.get(sum), max);
			}
		}
        return max;
    }
}
```
['Java']