✅ Java Solution
CODE\nJava []\nprivate int findans(int[] nums1, int[] nums2, int n, int res) {\n\tfor(int i=0; i<n; i++) {\n\t\tint ct = 1, x = nums2[0]-nums1[i], j=1, k=i+1;\n
## **CODE**\n```Java []\nprivate int findans(int[] nums1, int[] nums2, int n, int res) {\n\tfor(int i=0; i<n; i++) {\n\t\tint ct = 1, x = nums2[0]-nums1[i], j=1, k=i+1;\n\t\twhile(j < n-2 && k < n) {\n\t\t\tif(nums1[k++]+x == nums2[j]) {\n\t\t\t\tct++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\n\t\tif(j == n-2) {\n\t\t\tif(res == -1 || res > x) res = x;\n\t\t}\n\t}\n\treturn res;\n}\n\npublic int minimumAddedInteger(int[] nums1, int[] nums2) {\n\tArrays.sort(nums1);\n\tArrays.sort(nums2);\n\n\treturn findans(nums1, nums2, nums1.length, nums2[nums2.length-1]-nums1[0]);\n}\n```
['Java']