Search
⌘K

Leetcode 1074. Number of Submatrices That Sum to Target

Count the number of non-empty submatrices in a 2D integer matrix whose elements sum to a given target. The common approach reduces the 2D problem to many 1D subarray-sum problems by fixing row pairs and using prefix-sum + hash counting (O(rows^2 * cols), feasible for up to 100x100).

Asked at:

Meta


Question Timeline

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

Mid January, 2025

Meta

Senior

Determine if there's an interval that sums to the target in a given array

Mid January, 2025

Meta

Senior

Determine if there's an interval that sums to the target in a given array

Comments

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