Search
⌘K

Leetcode 1314. Matrix Block Sum

Given an m×n matrix and integer k, compute for each cell the sum of all elements inside the (2k+1)×(2k+1) square centered at that cell, clipped to matrix boundaries. The core challenge is computing all these sliding block sums efficiently (typically via a 2D prefix-sum / summed-area table to get each block sum in O(1) after O(mn) preprocessing).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.