Skip to content

Commit 0579616

Browse files
authored
1 parent c6de535 commit 0579616

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class Solution {
2+
public int MinimumDifference(int[] nums, int k) {
3+
int min = Int32.MaxValue;
4+
int l = 0, r = k - 1;
5+
Array.Sort(nums);
6+
while (r < nums.Length) {
7+
min = Math.Min(min, nums[r] - nums[l]);
8+
l++;
9+
r++;
10+
}
11+
return min;
12+
}
13+
}

0 commit comments

Comments
 (0)