Sort and skip
C++\ncpp\nint minimumDifference(vector<int>& nums, int k) {\n    int res = INT_MAX;\n    sort(begin(nums), end(nums));\n    for (int i = k - 1; i < nums.size();
**C++**\n```cpp\nint minimumDifference(vector<int>& nums, int k) {\n    int res = INT_MAX;\n    sort(begin(nums), end(nums));\n    for (int i = k - 1; i < nums.size(); ++i)\n        res = min(res, nums[i] - nums[i - k + 1]);\n    return res;\n}\n```
[]