[Java] Sort & Sliding Window || Easy to understand
\nclass Solution {\n    public int minimumDifference(int[] nums, int k) {\n        if(k == 1)return 0;\n        int i = 0,j = k-1,res = Integer.MAX_VALUE;\n\t\t
```\nclass Solution {\n    public int minimumDifference(int[] nums, int k) {\n        if(k == 1)return 0;\n        int i = 0,j = k-1,res = Integer.MAX_VALUE;\n\t\t\n        Arrays.sort(nums);\n        while(j < nums.length){\n            res = Math.min(res,nums[j] - nums[i]);\n            j++;\n            i++;\n        }\n\t\t\n        return res;\n    }\n}\n```
['Java']