Clear typescript solution (beats 100%)
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: $$O(n^2)$$\n\n- Space complexity: $$O(n)$$\n\n# Code\n```\nfunction recoverArray(nums: number[]): number[] {\n    nums = nums.sort((a, b) => a - b)\n    const half: number = nums.length / 2\n\n    const getResultForK = (k: number): number[] => {\n        const result: number[] = []\n\n        const counts: Map<number, number> = nums.reduce((acc, cur) => {\n            acc.set(cur, (acc.get(cur) || 0) + 1)\n            return acc\n        }, new Map<number, number>())\n\n        for (let num of nums) {\n            if (counts.get(num) === 0) {\n                continue\n            }\n\n            if (counts.get(num + k) === 0) {\n                return []\n            }\n\n            counts.set(num, counts.get(num) - 1)\n            counts.set(num + k, counts.get(num + k) - 1)\n\n            result.push(num + k / 2)\n        }\n\n        if (result.length !== half) {\n            return []\n        }\n\n        return result\n    }\n\n    for (let i = 1; i <= half; i++) {\n        const k: number = nums[i] - nums[0]\n\n        if (k !== 0 && k % 2 === 0) {\n            const result = getResultForK(k)\n\n            if (result.length > 0) {\n                return result\n            }\n        }\n    }\n}\n```
['TypeScript']