Quant Memo
Coding/●●●●●

Apply many range bonuses with a difference array

You start with an all-zero array of n days. You are given many operations, each "add delta to every day in [l, r] inclusive". After applying them all, return the final array.

n = 5, ops = [(0, 2, 3), (1, 4, -1)]
-> [3, 2, 2, -1, -1]

Apply each range update in O(1)O(1), then produce the final array in O(n)O(n).

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions