You are given a **0-indexed** integer array `nums`

, where `nums[i]`

represents the score of the `i`

student. You are also given an integer ^{th}`k`

.

Pick the scores of any `k`

students from the array so that the **difference** between the **highest** and the **lowest** of the `k`

scores is **minimized**.

Return *the minimum possible difference*.

**Example 1:**

Input:nums = [90], k = 1Output:0Explanation:There is one way to pick score(s) of one student: - []. The difference between the highest and lowest score is 90 - 90 = 0. The minimum possible difference is 0.90

**Example 2:**

Input:nums = [9,4,1,7], k = 2Output:2Explanation:There are six ways to pick score(s) of two students: - [,9,1,7]. The difference between the highest and lowest score is 9 - 4 = 5. - [4,4,9,7]. The difference between the highest and lowest score is 9 - 1 = 8. - [1,4,1,9]. The difference between the highest and lowest score is 9 - 7 = 2. - [9,7,4,7]. The difference between the highest and lowest score is 4 - 1 = 3. - [9,1,1,4]. The difference between the highest and lowest score is 7 - 4 = 3. - [9,4,7,1]. The difference between the highest and lowest score is 7 - 1 = 6. The minimum possible difference is 2.7

**Constraints:**

`1 <= k <= nums.length <= 1000`

`0 <= nums[i] <= 10`

^{5}

```
struct Solution;
impl Solution {
fn minimum_difference(mut nums: Vec<i32>, k: i32) -> i32 {
let k = k as usize;
nums.sort_unstable();
let mut min = std::i32::MAX;
for w in nums.windows(k) {
min = min.min(w[k - 1] - w[0]);
}
min
}
}
#[test]
fn test() {
let nums = vec![90];
let k = 1;
let res = 0;
assert_eq!(Solution::minimum_difference(nums, k), res);
let nums = vec![9, 4, 1, 7];
let k = 2;
let res = 2;
assert_eq!(Solution::minimum_difference(nums, k), res);
}
```