2dbi

Minimum Time to Complete All Tasks

viaLeetCode

There are n tasks, each needing to run for a given duration within an inclusive [start, end] time window. Multiple tasks may run in the same second (shared CPU time). Find the minimum total number of seconds the CPU must be turned on to complete all tasks. Sort by end time and greedily reuse the latest seconds (sweepline / greedy, or Fenwick tree for large ranges). (LeetCode "Minimum Time to Complete All Tasks".)

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account