Easy || C++ || Brute-force Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n- Ad-hoc (Brute-force) approach\n\n# Approach\n Describe your approach to solving the p
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Ad-hoc (Brute-force) approach\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Sort both array (vector)\n- Try all possibilities to remove 2 elements from nums1.\n- Check after removing elements diffs of all elements in nums1 and nums2 are equals\n- If above second condition matched consider that as possible solution.\n- Track minimum of all possible solutions.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n^3)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumAddedInteger(vector<int>& nums1, vector<int>& nums2) {\n        int ret = 1001;\n        sort(nums1.begin(), nums1.end());\n        sort(nums2.begin(), nums2.end());\n\n        for (int i = 0; i < nums1.size(); i++) {\n            for (int j = i+1; j < nums1.size(); j++) {\n                int mn = -1;\n                if (i > 0) {\n                    mn = 0;\n                } else {\n                    if (j > 1) {\n                        mn = 1;\n                    } else {\n                        mn = 2;\n                    }\n                }\n\n                int x = nums2[0] - nums1[mn];\n                int l = 0;\n                bool f = true;\n                for (int k = 0; k < nums1.size(); k++) {\n                    if (k == i || k == j) continue;\n                    if ((nums2[l] - nums1[k]) != x) {\n                        f = false;\n                        break;\n                    }\n                    l++;\n                }\n                if (f) {\n                    if (x < ret) ret = x;\n                }\n            }\n        }\n\n        return ret;\n    }\n};\n```
['C++']