C++ beginneer friendly Solution
Intuition\n Describe your first thoughts on how to solve this problem. \nSort + find the minimum element differnece\n# Approach\n Describe your approach to solv
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSort + find the minimum element differnece\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)$$ -->\nO(nlog n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool check(vector<int>& nums1, vector<int>& nums2, int x){\n        int j=0;\n        int count= 0;\n        for(int i=0; i<nums1.size() && j<nums2.size(); i++){\n            if(nums1[i] + x != nums2[j]) count++;\n            else j++;\n        }\n        return count<=2;\n    }\n    int minimumAddedInteger(vector<int>& nums1, vector<int>& nums2) {\n        sort(nums1.begin(), nums1.end());\n        sort(nums2.begin(), nums2.end());\n        int diff = INT_MAX;\n        int n = min( 3 , int(nums1.size()));\n        for(int i=0; i<n ; i++){\n           int x = nums2[0] - nums1[i];\n           if(check(nums1,nums2,x)){\n            cout<<" x is"<<x<<endl;\n            diff = min(diff,x);\n           }\n        }\n        return diff;\n    }\n};\n\n```
['Sorting', 'C++']