O(n) | Beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n- Calculate total sum\n- Store index of each value\n- Iterate through nums\n  - Calcula
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Calculate total sum\n- Store index of each value\n- Iterate through nums\n  - Calculate curr_sum = total - val\n  - if val is an outlier, then curr_sum should be even and \n  d[curr_sum // 2] must be equal to 1\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n# Code\n```python3 []\nclass Solution:\n    def getLargestOutlier(self, nums: List[int]) -> int:\n        s = collections.defaultdict(int)\n        for i, v in enumerate(nums):\n            s[v] = i\n        total = sum(nums)\n        res = float(\'-inf\')\n        for i,num in enumerate(nums):\n            curr_sum = total - num\n            if curr_sum%2 == 0: \n                val = curr_sum // 2\n                if val in s and s[val] != i:\n                    res = max(res, num)\n        return res\n```
['Python3']