Simple Solution using multiset!!!⚡🔥💕💕
\n# Code\n\nclass Solution {\npublic:\n    bool f(multiset<int>ms,int n,int k,vector<int>&ans){\n        while(!ms.empty()){\n            int smallest1=*ms.begi
\n# Code\n```\nclass Solution {\npublic:\n    bool f(multiset<int>ms,int n,int k,vector<int>&ans){\n        while(!ms.empty()){\n            int smallest1=*ms.begin();\n            int smallest2=smallest1+2*k;\n            if(ms.find(smallest2)==ms.end())return false;\n            ans.push_back(smallest1+k);\n            ms.erase(ms.begin());\n            auto it=ms.find(smallest2);\n            ms.erase(it);\n        }\n        return true;\n    }\n    vector<int> recoverArray(vector<int>& nums) {\n        int n=nums.size();\n        sort(nums.begin(),nums.end());\n        multiset<int>ms(nums.begin(),nums.end());\n        int lowest=nums[0];\n        for(int i=1;i<n;i++){\n            vector<int>ans;\n            int highest=nums[i];\n            if((highest-lowest)%2)continue;\n            int k=(highest-lowest)/2;\n            if(k && f(ms,n,k,ans))return ans;\n        }\n        return {};\n        \n    }\n};\n```
['C++']