Solution - worked may need improvements
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\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)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    func minimumAddedInteger(_ nums1: [Int], _ nums2: [Int]) -> Int {\n            let sortedNums1 = nums1.sorted()\n    let sortedNums2 = nums2.sorted()\n\n    var ret = 9999999\n    let firstPossible = sortedNums2[0] - sortedNums1[0]\n    let secondPossible = sortedNums2[0] - sortedNums1[1]\n    let thirdPossible = sortedNums2[0] - sortedNums1[2]\n\n    // first\n    var k = 0\n    var counter = 0\n    for cur in sortedNums1 {\n        if k == sortedNums2.count {\n            break\n        }\n        let curK = sortedNums2[k]\n        if curK - cur != firstPossible {\n            counter += 1\n            continue\n        }\n        k += 1\n    }\n    if counter <= 2 {\n        ret = min(ret, firstPossible)\n    }\n\n    // second\n    k = 0\n    counter = 1\n    for i in 1..<sortedNums1.count {\n        if k == sortedNums2.count {\n            break\n        }\n        let cur = sortedNums1[i]\n        let curK = sortedNums2[k]\n        if curK - cur != secondPossible {\n            counter += 1\n            continue\n        }\n        k += 1\n    }\n    if counter <= 2 {\n        ret = min(ret, secondPossible)\n    }\n\n    // third\n    k = 0\n    counter = 2\n    for i in 2..<sortedNums1.count {\n        if k == sortedNums2.count {\n            break\n        }\n        let cur = sortedNums1[i]\n        let curK = sortedNums2[k]\n        if curK - cur != thirdPossible {\n            counter += 1\n            continue\n        }\n        k += 1\n    }\n    if counter <= 2 {\n        ret = min(ret, thirdPossible)\n    }\n\n    return ret\n    }\n}\n```
['Swift']