Java | simple approach
\n\n# Code\njava []\nclass Solution {\n    public int minimumDifference(int[] nums, int k) {\n        Arrays.sort(nums);\n        int min=Integer.MAX_VALUE;\n  
\n\n# Code\n```java []\nclass Solution {\n    public int minimumDifference(int[] nums, int k) {\n        Arrays.sort(nums);\n        int min=Integer.MAX_VALUE;\n        for(int i=0;i<nums.length-k+1;i++){\n            int j=i+k-1;\n            int temp=nums[j]-nums[i];\n            min=Math.min(min,temp);\n        }\n        return min;\n    }\n}\n```
['Java']