Swift interpretation of the top O(max(n,k)) method
Here is the Swift version\n\nswift\nclass Solution {\n    func minMoves(_ nums: [Int], _ limit: Int) -> Int {\n        var delta: [Int] = Array(repeating: 0, co
Here is the Swift version\n\n```swift\nclass Solution {\n    func minMoves(_ nums: [Int], _ limit: Int) -> Int {\n        var delta: [Int] = Array(repeating: 0, count: 2 * limit + 2)\n        let n = nums.count\n        for i in 0..<n / 2{\n            let a = nums[i]\n            let b = nums[n - 1 - i]\n            delta[2] += 2\n            delta[min(a, b) + 1] -= 1\n            delta[a + b] -= 1\n            delta[a + b + 1] += 1\n            delta[max(a, b) + limit + 1] += 1\n        }\n        var res = 2 * n\n        var curr = 0\n        for i in 2...2 * limit {\n            curr += delta[i]\n            res = min(res, curr)\n        }\n        return res\n    }\n}\n\n```
['Swift']