Java O(N) HashMap
IntuitionIf we pick a number off the nums array, how can we in O(1) time determine if it's an outliner? The easiest way is if the sum of the special numbers is
# Intuition
If we pick a number off the nums array, how can we in O(1) time determine if it's an outliner? The easiest way is if the sum of the special numbers is there, then it has to be `(sum(nums) - outliner) / 2`


# Complexity
- Time complexity:
O(N)

- Space complexity:
O(N)

# Code
```java []
class Solution {
    public int getLargestOutlier(int[] nums) {
        // [-5, -3, -2, 10]
        HashMap<Integer, Integer> counter = new HashMap<>();
        int sum = 0;
        for (int n : nums) {
            sum += n;
            int current = counter.getOrDefault(n, 0);
            counter.put(n, current + 1);
        }

        int biggestNumber = -10000;

        for (int i = nums.length - 1; i >= 0; --i) {
            int out = nums[i];
            int rest = sum - out;
            if (rest % 2 != 0) continue;
            int total_sum = rest / 2;

            if (out == total_sum) {
                if (counter.get(total_sum) >= 2) {
                    if (out > biggestNumber) {
                        biggestNumber = out;
                    }
                }
            } else {
                if (counter.containsKey(total_sum)) {
                    if (out > biggestNumber) {
                        biggestNumber = out;
                    }
                }
            }
        }
        return biggestNumber;
    }
}
```
['Java']