HashMap and sum
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 getLargestOutlier(int[] nums) {

        int sum = 0;
        HashMap<Integer, List<Integer>> vToI = new HashMap<>();
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < nums.length; ++i) {
            sum += nums[i];
            if(!vToI.containsKey(nums[i])) {
                vToI.put(nums[i], new LinkedList<>());
            }

            vToI.get(nums[i]).add(i);
        } 

        for (int i = 0; i < nums.length; ++i) {
            int sumRest = sum - nums[i] * 2;

            if (vToI.containsKey(sumRest) && (vToI.get(sumRest).size() > 1 || vToI.get(sumRest).get(0) != i)) {
                max = Math.max(sumRest, max);
            }
        }

        return max;
        
    }
}
```
['Java']