Problem Brief
Process Execution Time
FULLTIMENEW GRADOA
You are given the inclusive start and end times of multiple processes. Compute the total amount of time during which at least one process is running.
Intervals are inclusive, so a process running from 1 to 5 contributes 5 - 1 + 1 = 5 units of time. Overlapping intervals should be merged before summing their lengths.
Return the total covered time.
1Example 1
Input
start = [1, 2, 8], end = [5, 6, 10]
Output
9
Explanation
The first two processes merge into [1, 6] for 6 units. The third process contributes 3 more units from [8, 10]. Total = 9.
Constraints
Limits and guarantees your solution can rely on.
1 <= n <= 2 * 10^51 <= start[i] <= end[i] <= 10^9