The example they gave was tasks like (23, 60) which wraps past midnight and that's where I fumbled at first.
Model each task as an interval on a circular timeline, then use a sweep-line algorithm with a difference array to count concurrent tasks. Handle wrap-around by splitting tasks that cross midnight into two intervals or by duplicating the timeline. The maximum overlap count is the minimum number of servers needed.
Pro tip: Clarify with the interviewer whether tasks can be scheduled at any time or if start times are fixed; if fixed, the problem reduces to finding maximum overlap. Also, mention that if tasks can be shifted, it becomes a circular interval graph coloring problem, which is more complex.
Ask if start times are fixed or flexible, and confirm that tasks cannot be preempted. Discuss how to handle tasks that wrap past midnight (e.g., split into two intervals).
Decide between converting times to minutes since midnight and using a difference array, or using an event-based sweep line. For circular handling, consider duplicating the timeline or splitting wrap-around tasks.
For fixed start times, compute the maximum number of overlapping tasks using a sweep line or difference array. For flexible start times, model as circular interval graph coloring and use a greedy algorithm after sorting by start time.
Compare time and space complexity of approaches: O(n log n) for sorting-based sweep vs O(n + T) for difference array (T=1440). Discuss trade-offs between simplicity and efficiency.
Walk through a small example, including a task that wraps midnight, to verify correctness. Consider edge cases like all tasks overlapping or no overlap.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.