Tap here to switch tabs
Problem
Submissions

Problem: Max Sum of Rectangle No Larger Than K

Try to solve the Max Sum of Rectangle No Larger Than K problem.

Statement

Given an m×nm \times n integer matrix matrix and an integer k, return the maximum sum of a rectangular submatrix whose sum is less than or equal to k.

It is guaranteed that there will be at least one rectangular submatrix with a sum no larger than k.

Constraints:

  • m == matrix.length

  • n == matrix[i].length

  • 1≤1 \leq m, n ≤100\leq 100

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

  • −105≤-10^5 \leq k ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Max Sum of Rectangle No Larger Than K

Try to solve the Max Sum of Rectangle No Larger Than K problem.

Statement

Given an m×nm \times n integer matrix matrix and an integer k, return the maximum sum of a rectangular submatrix whose sum is less than or equal to k.

It is guaranteed that there will be at least one rectangular submatrix with a sum no larger than k.

Constraints:

  • m == matrix.length

  • n == matrix[i].length

  • 1≤1 \leq m, n ≤100\leq 100

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

  • −105≤-10^5 \leq k ≤105\leq 10^5