TRAYA HEALTH Off-Campus Hiring | Interview Question OA (2024)

Question · Posted Jun 2026

Minimum Difference Between Highest and Lowest of K Scores Problem Statement You are given an integer array nums, where each element represents a student's score, and an integer k. Choose exactly k scores such that the difference between the highest and lowest selected scores is minimized. Return the minimum possible difference. Example Input nums = [9,4,1,7] k = 2 Output 2 Explanation After sorting: [1,4,7,9] Possible groups of size 2: [1,4] → Difference = 3 [4,7] → Difference = 3 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account