using map as n(unique numbers) much less than total numbers
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 []
/*
constraints:
nums, n 
n-2 => special numbers
one of the remaining 2 => sum(special numbers)
other => outlier
^ distinct indices but could be of same value
atleast one potential outlier exists
return the largest outlier

brute force:

*/
class Solution {
    public int getLargestOutlier(int[] nums) {
        int sum = 0;
        int max_outlier = Integer.MIN_VALUE;
        Map<Integer, Integer> map = new HashMap<>();
        for(int i =0; i< nums.length; i++)
        {
           sum+=nums[i];
           if(map.containsKey(nums[i]))
                map.put(nums[i], map.get(nums[i])+1);
            else
                map.put(nums[i],1);
        }
        for(int i=0;i<nums.length;i++){
            int potential_outlier = nums[i];
            int remaining_sum = sum - nums[i];
            if(remaining_sum % 2 == 0 && map.containsKey(remaining_sum/2) && 
                ((potential_outlier != remaining_sum/2) || map.get(remaining_sum/2)>1)){
                    max_outlier = Math.max(potential_outlier, max_outlier);
            }
        }
        return max_outlier;
    
    }
}
```
['Java']