Code Room
CodingEasycod-g1299
Subject Prefix sumLevel Entry–Mid~13 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.