You have an array of length initialized to zeros. You're given update operations. Each operation adds a value to all elements from index to inclusive.
Return the final array. You're solving the textbook difference array problem. With updates and length , naive approach is . With difference arrays, it's . Read the problem carefully.