Easy solution || O(N) || Beats 50% of submissions
```\nclass Solution {\npublic:\n    int minimumDifference(vector& nums, int k) {\n        if(k==1)\n            return 0;\n        sort(nums.begin(),nums.end())
```\nclass Solution {\npublic:\n    int minimumDifference(vector<int>& nums, int k) {\n        if(k==1)\n            return 0;\n        sort(nums.begin(),nums.end());\n        int res;\n        res=(nums[k-1]-nums[0]);\n        for(int i=k;i<nums.size();i++){\n            res=min(res,(nums[i]-nums[i-(k-1)]));\n        }\n        return res;\n    }\n};
['C', 'C++']