Simple O(nlogn) Java Solution
Complexity\n- Time complexity: O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
# Complexity\n- Time complexity: O(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minimumAddedInteger(int[] nums1, int[] nums2) {\n        Arrays.sort(nums1);\n        Arrays.sort(nums2);\n\n        int ans = Integer.MAX_VALUE;\n\n        for (int i = 0; i < 3; i++) {\n            int diff = nums2[0] - nums1[i];\n\n            int j = 0;\n            for (int k = 0; k < nums1.length && j < nums2.length; k++) {\n                if (nums1[k] + diff != nums2[j]);\n                else j++;\n            }\n\n            if (j == nums2.length) {\n                ans = Math.min(ans, nums2[0] - nums1[i]);\n            }\n        }\n\n        return ans;\n    }\n}\n```
['Java']