Counters after many range updates
A row of n counters starts at zero. Each update is a triple [start, end, delta] that adds delta to every counter from index start through end, both included. Return the list of counters after all the updates.
n >= 1, 0 <= start <= end < n, and delta may be negative. Ranges can be long, so touching every counter of every range is too slow: aim for O(n + u) with u updates.
Besides the tests, one large input (4,000 counters, 4,000 updates) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
apply_updates(6, [[0,2,5],[1,4,-2],[3,5,1]])→[5,3,3,-1,-1,1]apply_updates(4, [[0,3,1],[0,3,1],[3,3,10]])→[2,2,2,12]apply_updates(3, [])→[0,0,0]