C++ Simple Solution using queue
Approach\nWe need to find K such that orginalArray[i] - k , orginalArray[i] + k both exist in the nums array but we have low and high arrays merged so we can sa
**Approach**\nWe need to find **K** such that orginalArray[i] - k , orginalArray[i] + k both exist in the *nums* array but we have *low* and *high* arrays merged so we can say *high[i] - 2k = low[i]*.Since *N* is just 1000 we can try to find elements in low and high arrays for all possible values of *K*.\n\n```\nclass Solution {\npublic:\n    vector<int> recoverArray(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        for(int i=1;i<nums.size();i++)\n        {\n            if((nums[i] - nums[0])%2 == 0 && (nums[i] - nums[0]) > 0)\n            {\n                int k = nums[i]-nums[0];\n                queue<int> q;\n                q.push(nums[0]);\n                vector<int> ans;\n                for(int i=1;i<nums.size();i++)\n                {\n                    if(!q.empty() && nums[i] - k == q.front())\n                    {\n                        ans.push_back(nums[i] - k/2);\n                        q.pop();\n                    }\n                    else\n                    {\n                        q.push(nums[i]);\n                    }\n                }\n                if(q.empty())\n                {\n                    return ans;\n                }\n            }\n        }\n        return {};\n    }\n};\n```\n\nsolve the given below simple version of this problem using queue:\n[https://leetcode.com/problems/find-original-array-from-doubled-array/](http://)\n
['Queue', 'C', 'Sorting']