Tap here to switch tabs
Problem
Submissions

Problem: Minimum Difference Between Highest and Lowest K Scores

Try to solve the Minimum Difference Between Highest and Lowest of K Scores problem.

Statement

You are given an integer array nums representing the scores of students and an integer k.

Choose the scores of any k students from nums such that the difference between the highest score and the lowest score among the chosen k scores is minimized.

Return the minimum possible difference.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤1000\leq 1000

  • 0≤0 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Difference Between Highest and Lowest K Scores

Try to solve the Minimum Difference Between Highest and Lowest of K Scores problem.

Statement

You are given an integer array nums representing the scores of students and an integer k.

Choose the scores of any k students from nums such that the difference between the highest score and the lowest score among the chosen k scores is minimized.

Return the minimum possible difference.

Constraints:

  • 1≤1 \leq k ≤\leq nums.length ≤1000\leq 1000

  • 0≤0 \leq nums[i] ≤105\leq 10^5