Dsa
Greedy
Warm-up
Task Scheduler
You are a project manager with a list of tasks to complete, each having a completion time. Your goal is to determine the minimum amount of time required to finish all tasks. Input consists of an integer n (the number of tasks) followed by n integers (the time each task takes). Output the total time when all tasks are completed in the order of the least time first.
Example:
Input:
4
5 3 2 8
Output:
18
Key concepts
greedyprioritysorting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now