Python3 solution | Binary search
IntuitionUse binary search.ApproachWe have an array nums with some properties.
nums = [special_numbers, special_numbers_sum, outliner],
where sum(special_number
# Intuition
Use binary search.

# Approach
We have an array nums with some properties.
- nums = [special_numbers, special_numbers_sum, outliner],
- where sum(special_numbers) == special_numbers_sum.
Sort nums.
So we can check for each number if it is an outliner and if in the remaining array there is another number which is equal to the sum of the remaining numbers (which are all special).
This means we can rewrite it like this:
```
total_sum = sum(nums)
counter = Counter(nums)
sum_w8_outliner = total_sum - outliner
```
if there is an element from nums for this to be true:
```
sum_of_special == nums[mid] and ((nums[mid] == outliner and counter[outliner] >= 2) or nums[mid] != outliner)
```
it means that the chosen element is the sum of the special elements and the outliner is correct and we can pick it.



# Complexity
- Time complexity:
O(m) where m = 2000 for the counter

- Space complexity:
O(n*logn)

# Code
```python3 []
class Solution:
    def getLargestOutlier(self, nums: List[int]) -> int:
        ans = -math.inf
        nums.sort()

        def get_number(nums, outliner, total_sum, counter):
            sum_w8_outliner = total_sum - outliner

            start, end = 0, len(nums)-1
            while start <= end:
                mid = (start + end) // 2
                sum_of_special = sum_w8_outliner - nums[mid]
                if sum_of_special == nums[mid] and ((nums[mid] == outliner and counter[outliner] >= 2) or nums[mid] != outliner):
                    return outliner
                elif sum_of_special > nums[mid]:
                    start = mid + 1
                else:
                    end = mid - 1
            return None

        total_sum = sum(nums)
        counter = Counter(nums)
        for i in range(len(nums)):
            result = get_number(nums, nums[i], total_sum, counter)
            if result is not None:
                ans = max(ans, result)
        return ans
```
['Binary Search', 'Python3']