Answer: DoorDash OA Question 2024 June | Greedy | on-campus
Answer · Posted Jun 2026
Solution: Task Scheduler — Greedy Math Formula Approach We use a Greedy mathematical formula. The key insight is that the most frequent task determines the minimum time needed: Let maxFreq be the frequency of the most frequent task. Let maxCount be the number of tasks that share this maximum frequency. The minimum intervals needed is: (maxFreq - 1) * (n + 1) + maxCount. However, if we have many different tasks that fill all idle slots, the answer is simply ...
The full answer & interview discussion are available to premium members.
Log in Create a free account