85+ in speed and memory using Python3
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```\nfrom collections import Counter\nclass Solution:\n    def recoverArray(self, nums: List[int]) -> List[int]:\n        nums.sort()\n        smallest, largest = nums[0], nums[-1]\n        nums_counter = Counter(nums)\n        knums = list(nums_counter.keys())\n\n        for knum in knums[1:]:\n            K = knum - smallest\n            if K & 1 or smallest + K not in nums_counter or largest - K not in nums_counter:\n                continue\n            \n            ans = []\n            numsc = nums_counter.copy()\n                        \n            for num in knums:\n                if numsc[num] == 0:\n                    continue\n                if num + K not in numsc or numsc[num + K] == 0:\n                    break\n            \n                count = min(numsc[num], numsc[num + K])        \n                numsc[num] -= count\n                numsc[num + K] -= count\n\n                ans += [num + K//2]*count\n       \n            if len(ans) == len(nums) // 2:\n                return ans\n```
['Python3']