Problem 1074 · Hard

Number of Submatrices That Sum to Target

Fix a pair of rows, collapse the columns between them, and count subarrays with a prefix-sum table.

Open the interactive visualisation