Python | Hashmap | O(n)
Code
# Code
```python3 []
from collections import defaultdict
class Solution:
    def getLargestOutlier(self, nums: List[int]) -> int:
        idx = defaultdict(set)
        for i,num in enumerate(nums):
            idx[num].add(i)
        T = sum(nums)
        res = float('-inf')
        for i,num in enumerate(nums):
            R = T-num
            if R%2 == 0 and R//2 in idx:
                if len(idx[R//2]) > 1:
                    res = max(res, num)
                elif i not in idx[R//2]:
                    res = max(res, num)
        return res
```
['Python3']