Java Clean
from N = 1000, we know we can try something similar to O(n2)\nwe find out K is actually a limited number, it would be the difference between first element with 
from N = 1000, we know we can try something similar to O(n2)\nwe find out K is actually a limited number, it would be the difference between first element with all the rest number, one by one, when we have this list of k, we can try them one by one.\n\nwhen we have a possible k to guess, we will see if both low (nums[i]) and high (nums[i] + 2 * k) exist, and we increase counter by 1 (here in code has use tmp array), if counter is N / 2 in the end, we will conclue that we find one possible answer.\n\n```\nclass Solution {\n    public int[] recoverArray(int[] nums) {\n        int N = nums.length;\n        Arrays.sort(nums);\n        List<Integer> diffList = new ArrayList<>();\n        for (int i = 1; i < N; i++) {\n            int diff = Math.abs(nums[i] - nums[0]);\n            if (diff % 2 == 0 && diff > 0) diffList.add(diff / 2);\n        }\n        Map<Integer, Integer> map1 = new HashMap<>();\n        for (int i = 0; i < N; i++)\n            map1.put(nums[i], map1.getOrDefault(nums[i], 0) + 1);\n        for (int diff : diffList) {\n            Map<Integer, Integer> map = new HashMap<>(map1);\n            List<Integer> tmp = new ArrayList<>();\n            for (int i = 0; i < N; i++) {\n\t\t\t    if (tmp.size() == N / 2) break;\n                int low = nums[i];\n                int high = low + 2 * diff;\n                if (map.containsKey(low) && map.containsKey(high)) {\n                    tmp.add(low + diff);\n                    map.put(low, map.get(low) - 1); \n                    map.put(high, map.get(high) - 1);\n                    if (map.get(low) == 0) map.remove(low);\n                    if (map.get(high) == 0) map.remove(high);\n                }\n            }\n            if (tmp.size() == N / 2) return tmp.stream().mapToInt(i -> i).toArray();\n        }\n        return null;\n    }\n}\n```
['Java']