Java solution using Binary Search
Approach
Sort the array.
Iterate from the end to find the potentially largest outlier.
Subtract the outlier to find the remaining sum of numbers.
If the remaini

# Approach
<!-- Describe your approach to solving the problem. -->
- Sort the array.
- Iterate from the end to find the potentially largest outlier.
- Subtract the outlier to find the remaining sum of numbers.
- If the remaining sum is odd, that outlier is not possible.
- If it is even, binary search the remaining array to check if the (remainingSum / 2) is present in the array. Search space can be restricted by comparing the value of nums[outlierIndex] with (remainingSum / 2).
- If found, return nums[outlierIndex].


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

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

# Code
```java []
class Solution {
    public boolean binarySearch(int[] nums, int l, int r, int num) {
        while(l <= r) {
            int mid = l + (r-l)/2;

            if(nums[mid] == num) return true;
            if(nums[mid] > num) {
                r = mid-1;
            } else {
                l = mid+1;
            }
        }
        return false;
    }
    public int getLargestOutlier(int[] nums) {
        Arrays.sort(nums);

        int totalSum = 0;
        for(int i: nums) {
            totalSum += i;
        }

        int outlierIndex = nums.length-1;
        while(true) {
            int currSum = totalSum - nums[outlierIndex];
            if(currSum % 2 == 0) {
                if(nums[outlierIndex] > currSum / 2) {
                    if(binarySearch(nums, 0, outlierIndex-1, currSum / 2)) return nums[outlierIndex];
                } else {
                    if(binarySearch(nums, outlierIndex+1, nums.length - 1, currSum / 2)) return nums[outlierIndex];
                }
            }
            outlierIndex--;
        }
    }
}
```
['Binary Search', 'Java']