Easy intutive solution. O(N) .
\n# Complexity\n- Time complexity:O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(N)\n Add your space complexity here, e.g. O(n) \n\n# 
\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nimport java.util.HashMap;\n\nclass Solution {\n    public int getLargestOutlier(int[] nums) {\n        int sum = 0;\n        for (int num : nums) {\n            sum += num;\n        }\n\n        HashMap<Integer, Integer> freqMap = new HashMap<>();\n        for (int num : nums) {\n            freqMap.put(num, freqMap.getOrDefault(num, 0) + 1);\n        }\n\n        int ans = Integer.MIN_VALUE;\n\n        for (int num : nums) {\n            int remainingSum = sum - num;\n            // System.out.println("Remaining sum: " + remainingSum);\n\n            if (remainingSum % 2 == 0) {\n                int p = remainingSum / 2;\n                // System.out.println("Checking for p: " + p);\n\n                if (freqMap.containsKey(p)) {\n                    if (p == num && freqMap.get(p) < 2) continue;\n\n                    ans = Math.max(ans, num);\n                    // System.out.println("Ans: " + ans);\n                }\n            }\n        }\n\n        return ans == Integer.MIN_VALUE ? -1 : ans;\n    }\n}\n\n```
['Hash Table', 'Math', 'Java']