Java Solution | Applying Mathematics | O(N)
IntuitionApproach
Check for each number as outlier
Rest values if they have one value as sum it should be divisible by 2
It should contain sum/2 also in rest of
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
- Check for each number as outlier
- Rest values if they have one value as sum it should be divisible by 2
- It should contain sum/2 also in rest of the element

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

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

# Code
```java []
import java.util.HashMap;
import java.util.Map;

class Solution {
    public int getLargestOutlier(int[] nums) {
        int totalSum = 0;
        Map<Integer, Integer> counts = new HashMap<>();
        
        // Calculate total sum and count frequencies
        for (int num : nums) {
            totalSum += num;
            counts.put(num, counts.getOrDefault(num, 0) + 1);
        }
        
        int outlier = Integer.MIN_VALUE;
        
        for (int num : nums) {
            // Temporarily remove current number
            counts.put(num, counts.get(num) - 1);
            totalSum -= num;
            
            // Check if remaining sum is even and contains sum/2
            if (totalSum % 2 == 0 && counts.getOrDefault(totalSum / 2, 0) > 0) {
                outlier = Math.max(outlier, num);
            }
            
            // Restore the number
            counts.put(num, counts.get(num) + 1);
            totalSum += num;
        }
        
        return outlier;
    }
}
```
['Array', 'Hash Table', 'Math', 'Counting', 'Java']