Book The Most Candidates Under Interviewer Daily Caps
Last updated: November 29, 2026
Quick Overview
Each candidate lists the slots they can attend, each slot belongs to one interviewer, and each interviewer has a maximum number of interviews per day. Assign candidates to distinct slots so the number of booked candidates is as large as possible.
Karat
November 29, 20260
0
0 solved
Each candidate lists the slots they can attend, each slot belongs to one interviewer, and each interviewer has a maximum number of interviews per day. Assign candidates to distinct slots so the number of booked candidates is as large as possible.
Matching candidates to a global pool of interviewers with per-person limits is a real scheduling problem for an interviewing service. The interviewer expects you to see that greedy fails, model it as max flow, and reason about why the capacity layer is needed.
What the Interviewer Expects
- Show a counterexample where greedy first-fit is not optimal
- Model as a flow network with source, candidates, slots, interviewers, sink
- Put the daily cap on the interviewer to sink edge
- Implement augmenting paths with residual edges
- Recover the assignment from saturated edges
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Candidates now rank slots. How do you maximize bookings and then preference?
- How would you handle a new candidate arriving without recomputing everything?
- Interviewers also need a break after two consecutive interviews. Can flow still model it?
- What is the complexity with Dinic's algorithm on this unit-capacity graph?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each slot hosts at most one candidate, each candidate takes at most one slot, and interviewer i hosts at most capacity[i] slots. Maximize booked candidates; any optimal assignment is acceptable....
High-Level Design
Greedy fails: if candidate a takes s1 first, b (who can only do s1) is stranded even though a could have used s2. Build a network: S to each candidate (cap 1), candidate to each acceptable slot (cap 1...