Recover the Original Array
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\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```javascript []\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar recoverArray = function (nums) {\n    nums.sort((a, b) => (a - b));\n\n    for (let i = 1; i <= nums.length / 2; i++) {\n        let twiceK = nums[i] - nums[0];\n        if (twiceK === 0 || twiceK % 2 === 1) continue;\n        let result = [];\n        let map = new Map();\n        for (let num of nums) {\n            let count = map.get(num - twiceK);\n            if (!count) {\n                map.set(num, (map.get(num) || 0) + 1);\n            } else {\n                result.push(num - twiceK / 2);\n                map.set(num - twiceK, count - 1);\n            }\n        }\n        if (result.length === nums.length / 2) {\n            return result;\n        }\n    }\n\n    return [];\n};\n```
['JavaScript']