Identify the Largest Outlier in an Array
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
```cpp []
class Solution {
public:
    int getLargestOutlier(vector<int>& nums) {
        int n = nums.size();
        long long temp = 0;
        map<int, int> m;
        int ans = INT_MIN;
        for (int i = 0; i < n; i++) {
            temp += nums[i];
            m[nums[i]] = i;
        }

        for (int i = 0; i < n; i++) {
            if ((temp - nums[i]) % 2 != 0) {
                continue;
            } else {
                int t = (temp - nums[i]) / 2;
                if (m.find(t) != m.end()) {
                    if (m[t] != i) {
                        // cout<<nums[i]<< "       "<<t<<"   "<<m[t]<<"   "<<i<<endl;
                        ans = max(ans, nums[i]);
                    }
                }
            }
        }
        return ans;
    }
};
```
['C++']