Peak concurrent job capacity

Write codeEasy13 min

Your task

A batch scheduler divides the day into n numbered slots (0 to n-1). Each scheduled job is a triple [start, end, amount]: it occupies every slot from start through end inclusive and consumes amount units of server capacity while it runs (0 <= start <= end < n, amount > 0). Jobs overlap freely. Return the peak total capacity consumed in any single slot; with no jobs scheduled, the peak is 0. Example: n = 4, jobs = [[0, 2, 3], [1, 3, 2]] gives 5, slot loads are [3, 5, 5, 2].

Examples

peak_slot_load(n: int, jobs: list[list[int]]) -> int
Example 1
Inputpeak_slot_load(4, [[0, 2, 3], [1, 3, 2]])
Output5