Mark As Completed Discussion

matrix[0][0] is now a 1. It gets bumped up again since it falls under the [2, 2] range. We can imagine the operations as layering over each other.

There is an associated insight from this one: the cells that are layered over the most are the ones with the greatest numbers.

So really the cells we're looking for are the ones that got layered over the most.

The easiest way to do is by looking at the minimum rows and columns of each operation, since those are the edges of coverage. The minimum guarantees that the greatest increments will at at least reach those boundaries.

Step Four

Time and space complexity is O(n).