Range increment updates
Your task
A calibration job replays a batch of corrections onto a strip of n energy-meter registers that all start at 0. Each correction is a triple [l, r, delta] meaning: add delta to every register from index l through r inclusive (0 <= l <= r < n; delta may be negative). Applying corrections one register at a time is too slow for large batches, process each correction in constant time and materialize the final register values once at the end. Return the final list. Example: n = 5, corrections = [[1, 3, 2], [0, 1, -1]] gives [-1, 1, 2, 2, 0].
Examples
final_registers(n: int, corrections: list[list[int]]) -> list[int]Example 1
Input
final_registers(5, [[1, 3, 2], [0, 1, -1]])Output
[-1, 1, 2, 2, 0]