Code RoomRange increment updates
EasyPrep Room Coding #485

Range increment updates

CodingAlgorithms & data structuresEntry–Mid~13 min

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].

Implement
final_registers(n: int, corrections: list[list[int]]) → list[int]
Examples
in[5,[[1,3,2],[0,1,-1]]]out[-1,1,2,2,0]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 13 min
InputExpectedGot
[5,[[1,3,2],[0,1,-1]]][-1,1,2,2,0]not run yetsample