ORIGINAL CODING QUESTION
Shortest longest interviewer day
An interview coordinator has n interviews, each with a positive length in minutes, and k interviewers. Every interview goes to exactly one interviewer, in any combination, and an interviewer may receive none. An interviewer day length is the total minutes of their interviews. Return the smallest possible length of the longest interviewer day.
Original exercise · hard. Editorial role relevance does not imply a company has asked this question.
Input and output
n k, then n interview lengths. Print the smallest possible longest day.
Constraints
1 ≤ n ≤ 10; 1 ≤ k ≤ 10; 1 ≤ length ≤ 1000.
Example 1
Input
5 2 3 2 3 2 2
Output
6
Days of {3,3} and {2,2,2} both last 6 minutes.
Example 2
Input
3 3 5 9 4
Output
9
Each interviewer takes one interview, so the longest day is 9.
Explain your approach
Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?
Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.
Hint 1
Try giving each interview to each interviewer, and keep the best longest day found so far.
Hint 2
Place the longest interviews first and abandon a branch once some day would reach the best answer already found.
Hint 3
Idle interviewers are interchangeable: try an interview on only the first idle interviewer to remove symmetric branches.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →