[Accepted] Swift
\nclass Solution {\n    func minimumDifference(_ nums: [Int], _ k: Int) -> Int {\n        \n        let nu = nums.sorted()\n        var mi = Int.max\n        \n
```\nclass Solution {\n    func minimumDifference(_ nums: [Int], _ k: Int) -> Int {\n        \n        let nu = nums.sorted()\n        var mi = Int.max\n        \n        for i in 0...(nu.count - k) {\n            mi = min(mi, nu[i + k - 1] - nu[i])\n        }\n        \n        return mi\n    }\n}\n```
['Swift']