Core Idea
A 2D difference array records rectangle updates at their corners. It is the two-dimensional version of a range-add difference array.
Algorithm
For rectangle (r1, c1, r2, c2), add at the top-left, subtract just after the bottom and right edges, and add back at the bottom-right outside corner.
Common Mistakes
After all updates, take prefix sums over rows and columns to recover the final grid. Boundary checks are the main source of mistakes.