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

Sign in to watch this lesson
Algorithms - Arrays · 4:36
Prefix sums move from a staircase to a grid: a table of corner sums, built in one pass with one overlap correction per cell, answers the sum of any rectangle with four lookups. We derive the four-corner formula from overlapping rectangles, time it against a plain loop on a Mac, and use it for sliding k-by-k windows and for the maximum-sum submatrix via row pairs and Kadane.