Hashmap + Math | C++ | O(N) 
IntuitionSet each number as outlier, try to find whether other elements can make sum element and special numbers.Based on constraints, would not be able to brut
# Intuition
Set each number as outlier, try to find whether other elements can make sum element and special numbers.

Based on constraints, would not be able to brute force as it is O(N^2).

A key observation is that if we exclude the outlier, the remaining sum of the numbers in the array is 2 * sum element. 
# Approach
1. Create a hashmap to store frequencies of each number in the array.
2. Calculate the sum of all elements in the array, `totalSum`.
3. Initialize a `largest` variable to keep track of the largest outlier.
4. Iterate through `nums`, using each number as a candidate for `outlier`
    - At each step, calculate the `remainingSum`, which is `totalSum - outlier`
    - `remainingSum` is only valid if it is even, if is not, we can ignore the current outlier candidate
    - If it is even, find the `sumElement`, which is `remainingSum / 2`
    - From here, there are three cases
        - `sumElement` is not in the hashmap, then we can continue
        - `sumElement` is in the hashmap and `sumElement != outlier`, meaning the current outlier is a valid candidate
        - `sumElement == outlier` but the frequency of sumElement in the hashmap is only 1, it needs to be 2 to be valid, so we ignore this
    - If it is a valid outlier, we maximize using `largest`
5. At the end, we return `largest`

# Complexity
- Time complexity: O(N) for two for loops

- Space complexity: O(N) as at most N unique numbers will be stored in the hashmap

# Code
```cpp []
class Solution {
public:
    int getLargestOutlier(vector<int>& nums) {
        std::unordered_map<int, int> numFreq;
        int totalSum{0};
        for (const auto& num: nums) {
            numFreq[num]++;
            totalSum += num;
        }
        int largest{INT_MIN};
        for (const auto& outlier: nums) {
            auto remainingSum{totalSum - outlier};
            if (remainingSum % 2 != 0) continue;
            auto sumElement{remainingSum / 2};
            if (!numFreq.contains(sumElement) || (sumElement == outlier && numFreq[sumElement] == 1)) continue;
            largest = std::max(largest, outlier);
        }
        return largest;
    }
};
```
['C++']