Minimum Cleaning Crews to Cover Same-Day Turnovers
Last updated: November 29, 2026
Quick Overview
Given same-day turnover cleaning windows as (start, end) minute pairs, find the minimum number of cleaning crews needed so that no crew is assigned two overlapping jobs, and return a crew assignment for each job.
Airbnb
November 29, 20260
0
0 solved
Given same-day turnover cleaning windows as (start, end) minute pairs, find the minimum number of cleaning crews needed so that no crew is assigned two overlapping jobs, and return a crew assignment for each job.
Airbnb co-hosts and professional cleaning partners juggle tight check-out to check-in windows across many listings. This warm-up checks that you know the min-heap approach to interval partitioning and can also produce an actual assignment, not only the count.
What the Interviewer Expects
- Sort jobs by start time
- Use a min-heap of crew end times to reuse the earliest free crew
- Treat end time equal to the next start as non-overlapping
- Return an assignment in the original input order
- State time and space complexity
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
- How would you account for travel time between listings?
- What if crews have different shift hours?
- How would you balance jobs evenly across crews rather than minimizing the count?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list of (start, end) with end exclusive. Output: (crew_count, assignment), where assignment[i] is the crew for job i. A crew finishing at 720 can start a job at 720....
High-Level Design
Process jobs by start time. Keep a heap of (end, crew_id) for busy crews. Before assigning a job, release every crew whose end is at or before the job's start. Reuse the smallest free crew id if any; ...