Easy Solution || try diff values of k
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```java []\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\n\nclass Solution {\n    // Method to get the possible doubled differences\n    public List<Integer> getDoubledDiff(int[] nums) {\n        int n = nums.length;\n        List<Integer> diff = new ArrayList<>();\n        for (int i = 1; i <n/2+1; i++) {\n            int dif = nums[i] - nums[0];\n            if (dif > 0 && dif % 2 == 0) {\n                diff.add(dif); // Add valid doubled difference\n            }\n        }\n        return diff;\n    }\n\n    // Method to get the solution based on a specific doubled difference\n    public List<Integer> getSolution(int[] nums, int diff) {\n        int n = nums.length;\n        HashMap<Integer, Integer> mp = new HashMap<>();\n        List<Integer> res = new ArrayList<>();\n\n        // Count frequencies of each element\n        for (int x : nums) {\n            mp.put(x, mp.getOrDefault(x, 0) + 1);\n        }\n\n        for (int i = 0; i < n; i++) {\n            // If current element exists in the map\n            if (mp.containsKey(nums[i])) {\n                mp.put(nums[i], mp.get(nums[i]) - 1);\n                if (mp.get(nums[i]) == 0) {\n                    mp.remove(nums[i]); // Remove if frequency is zero\n                }\n\n                int val = nums[i] + diff; // Calculate A + K\n                // Check if A + K exists in the map\n                if (!mp.containsKey(val)) {\n                    return res; // Return empty if not found\n                } else {\n                    mp.put(val, mp.get(val) - 1);\n                    if (mp.get(val) == 0) {\n                        mp.remove(val); // Remove if frequency is zero\n                    }\n\n                    // Add the original value A to the result\n                    res.add(nums[i] + diff / 2);\n                }\n            }\n        }\n        return res; // Return the successfully reconstructed array\n    }\n\n    public int[] recoverArray(int[] nums) {\n        int n = nums.length;\n        java.util.Arrays.sort(nums); // Sort the input array\n\n        List<Integer> doubledDiff = getDoubledDiff(nums); // Get possible doubled differences\n\n        for (int diff : doubledDiff) {\n            List<Integer> ans = getSolution(nums, diff); // Try to reconstruct with each diff\n            if (ans.size() == (n / 2)) { // If valid, return the result\n                int[] result = new int[ans.size()];\n                for (int i = 0; i < ans.size(); i++) {\n                    result[i] = ans.get(i); // Convert List to array\n                }\n                return result;\n            }\n        }\n        return new int[0]; // Return empty if no valid solution found\n    }\n}\n\n```
['Java']