Math pattern + hashmap
IntuitionApproachComplexity
Time complexity: O(n)

Space complexity: O(m)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(n) 
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(m)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def getLargestOutlier(self, nums: List[int]) -> int:

        # 1 sum, 1 outlier

        # outlier = total_sum − 2×sum
        # if outlier != sum
        # if outlier == sum, there should be 2 identical numbers -> so we need a hashmap

        # for each unique number
        # 1. treat it as the candidate sum
        # 2. get candidate outlier using the candidate sum

        total_sum = sum(nums)
        num_counts = Counter(nums)

        largest_outlier = float('-inf')

        for num in num_counts.keys():
            potential_sum = num
            potential_outlier = total_sum - 2 * potential_sum
            if potential_outlier in num_counts:
                if potential_outlier != potential_sum:
                    largest_outlier = max(largest_outlier, potential_outlier)
                else: # ==
                    if num_counts[potential_sum] > 1:
                        largest_outlier = max(largest_outlier, potential_outlier)

        return largest_outlier

        # time: O(n) 
        # - constructing the Counter: n
        # - iterating over the unique keys: m

        # space: O(m)
        # - Counter: unique keys = m 














        
```
['Python3']