Sorting and sliding window approach
Good morning folks, easy LC problem today, requiring a sorting (NLogN) and sliding window (N). Problem and solution down below - cheers, ACC. Minimum Difference Between Highest and Lowest of K Scores - LeetCode 1984. Minimum Difference Between Highest and Lowest of K Scores Easy 45 7 Add to List Share You are given a 0-indexed integer array nums , where nums[i] represents the score of the i th student. You are also given an integer 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 = 1 Output: 0 Explanation: There is one way to pick score(s) of one student: - [ 90 ]. The difference between the highest and lowest score is 90 - 90 = 0. The minimum possible difference is 0. Example 2...