Search
⌘K

Leetcode 370. Range Addition

Given an initial zero array and a list of range update operations [start, end, inc], apply all increments and return the final array; the challenge is to handle many range updates efficiently (better than naive per-element updates) using a difference-array / prefix-sum pattern to achieve O(n + k) time.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.