Tap here to switch tabs
Problem
Submissions

Problem: Number of Submatrices That Sum to Target

Try to solve the Number of Submatrices That Sum to Target problem.

Statement

Given a 22D integer matrix matrix and an integer target, return the number of non empty submatrices that sum to target.

A submatrix is defined by selecting all elements between a top left cell and a bottom right cell within matrix.

Constraints:

  • 1≤1 \leq matrix.length ≤100\leq 100

  • 1≤1 \leq matrix[0].length ≤100\leq 100

  • −1000≤-1000 \leq matrix[i][j] ≤1000\leq 1000

  • −108≤-10^8 \leq target ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Submatrices That Sum to Target

Try to solve the Number of Submatrices That Sum to Target problem.

Statement

Given a 22D integer matrix matrix and an integer target, return the number of non empty submatrices that sum to target.

A submatrix is defined by selecting all elements between a top left cell and a bottom right cell within matrix.

Constraints:

  • 1≤1 \leq matrix.length ≤100\leq 100

  • 1≤1 \leq matrix[0].length ≤100\leq 100

  • −1000≤-1000 \leq matrix[i][j] ≤1000\leq 1000

  • −108≤-10^8 \leq target ≤108\leq 10^8