Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 50s1 days 16 hours 1 minutes 50 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 50s1 days 16 hours 1 minutes 50 seconds.

Sign in to watch this lesson
Algorithms - Arrays · 4:23
The reverse of prefix sums: when many range updates come first and the array is read once at the end, store how each entry differs from the one before it. A range add becomes two writes, one prefix-sum sweep rebuilds the array, and on a grid four corner writes plus a 2D prefix sum do the same for rectangles. We time it against painting ranges cell by cell on a Mac and use it to find the busiest moment of a day of meetings.