Javascript - HashMap
Code\njavascript []\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar getLargestOutlier = function (nums) {\n  let sum = 0;\n  let ans = -Infinity;
# Code\n```javascript []\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar getLargestOutlier = function (nums) {\n  let sum = 0;\n  let ans = -Infinity;\n  const map = new Map();\n  for (const num of nums) {\n    map.set(num, (map.get(num) || 0) + 1);\n    sum += num;\n  }\n\n  for (let i = 0; i < nums.length; i++) {\n    const target = (sum - nums[i]) / 2;\n    if (!map.has(target)) continue;\n    if (target === nums[i] && map.get(target) === 1) continue;\n\n    ans = Math.max(nums[i], ans);\n  }\n\n  return ans;\n};\n\n```
['Hash Table', 'JavaScript']