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
Coding & Algorithms
Software Engineer
Karat
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

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
max flow
bipartite matching
Edmonds-Karp
residual graph
scheduling
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions