Model each task as an interval on a circular timeline, then use a sweep-line algorithm to count the maximum number of overlapping tasks. Handle durations exceeding 1440 minutes by decomposing them into full cycles plus a remainder, and account for wrap-around by splitting intervals that cross midnight or using a circular sweep.
Pro tip: Clarify with the interviewer whether tasks are fixed (non-preemptive) and whether servers can be reused immediately after a task ends. Also, mention that the answer is the maximum overlap, which equals the chromatic number for interval graphs, so a greedy assignment works.
Confirm that tasks are non-preemptive, servers can be reused immediately, and tasks run continuously. Discuss how to handle durations > 1440 minutes (e.g., a task lasting 2000 minutes occupies the server for multiple cycles).
For each task, compute its start and end times modulo 1440. If duration >= 1440, it covers the entire cycle, so it alone requires a dedicated server; otherwise, split the interval if it wraps around midnight (e.g., start=1400, end=100 becomes [1400,1440) and [0,100)).
Create events for each interval start (+1) and end (-1), sort them by time, and sweep to track the current number of active tasks. The maximum active count is the minimum number of servers needed.
For tasks that last 1440 minutes or more, they occupy a server for the entire cycle, so increment the server count by 1 for each such task and remove them from the sweep-line calculation.
Add the count of full-cycle tasks to the maximum overlap from the sweep-line. Discuss time complexity O(n log n) and space O(n), and mention alternative approaches like priority queues or greedy assignment.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.