C++ solution, use brute-foce to try each k.
\n\n1. sort the array\n2. because nums[0] is orginal[0] - k, then we can assume that nums[i] (i > 0) is original[0] + k, then k = (nums[i] - nums[0]) / 2\n3. tr
\n\n1. sort the array\n2. because nums[0] is orginal[0] - k, then we can assume that nums[i] (i > 0) is original[0] + k, then k = `(nums[i] - nums[0]) / 2`\n3. try all k to find the valid answer.\n    \n```\nclass Solution {\npublic:\n    vector<int> recoverArray(vector<int>& nums) {\n        sort(nums.begin(), nums.end());\n        multiset<int> ms;\n        for(auto x : nums) ms.insert(x);\n        for(int i = 1; i < nums.size(); i++) {\n            int d = nums[i] - nums[0];\n            if(d == 0 || d % 2) continue;\n            int k = d / 2;\n            auto t = ms;\n            vector<int> ans;\n            for(int i = 0; i < nums.size(); i++) {\n                auto it = t.find(nums[i]);\n                if(it == t.end()) continue;\n                if(nums[i] != *t.begin()) break;\n                auto it2 = t.find(nums[i] + 2 * k);\n                if(it2 == t.end()) continue;\n                t.erase(it);\n                t.erase(it2);\n                ans.push_back(nums[i] + k);\n            }\n            if(t.size() == 0) return ans;\n        }\n        return {};\n    }\n};\n```
[]