Easy HashMap Based Solution By Pui Pui
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n# Code\n```java []\nclass Solution {\n    public int getLargestOutlier(int[] nums) {\n\n        // So here is the algorithm that I was able to find out.\n        // 1. First we keep track of the count of the numbers and store their frequencies in the hashmap\n        // 2. Next we, iterate through each number and consider them as the outlier\n        //      a. If we consider them an outlier, then the remaining sum has to be even\n        //      b. If the remaining sum is even, the special number is half of the sum. and if that special\n        //          number exists, then the number at the given index can be considered as an outlier.\n        //  Likewise we will keep on checking each of the numbers for a potential outlier and finally\n        //  get the maximum one.\n        \n        Map<Integer, Integer> countMap = new HashMap<>();\n\n        // calculate the total sum here\n        int totalSum = 0;\n\n        for (int element : nums) {\n            countMap.put(element, countMap.getOrDefault(element, 0) + 1);\n\n            // we get the total sum of the elements in the array\n            totalSum += element;\n        }\n\n\n\n        int totalNums = nums.length;\n\n        \n\n        int maxOutlier = Integer.MIN_VALUE;\n\n        for (int i = 0; i < totalNums; i++) {\n            // I consider the current number as the outlier\n            int currentOutlier = nums[i];\n\n            // we reduce the count of the current outlier in the map\n            // this is taking into the consideration that the current number will not be\n            // considered.\n            countMap.put(currentOutlier, countMap.get(currentOutlier) - 1);\n\n            // now I generate the sum without considering the current number\n            int sumWithoutOutlier = totalSum - currentOutlier;\n\n            if ((sumWithoutOutlier & 1) == 0) {\n                // the sum is even\n                // so we take the half of the sum\n                int goodNumber = sumWithoutOutlier >> 1;\n                if (countMap.getOrDefault(goodNumber, 0) > 0) {\n                    // this means that the number exists\n                    // so the current outlier can be a valid candidate\n                    maxOutlier = Math.max(maxOutlier, currentOutlier);\n                }\n            }\n\n            // we reset the count of the current outlier in the map\n            countMap.put(currentOutlier, countMap.get(currentOutlier) + 1);\n        }\n\n        // we finally return the max outlier.\n        return maxOutlier;\n        \n    }\n}\n```
['Hash Table', 'Java']