Tap here to switch tabs
Problem
Submissions

Problem: Find Sorted Submatrices With Maximum Element at Most K

Try to solve the Find Sorted Submatrices With Maximum Element at Most K problem.

Statement

You are given an m×nm \times n integer matrix grid and an integer k.

A submatrix is considered sorted if every row within it is sorted in non increasing order.

Return the number of sorted submatrices such that the maximum element in the submatrix is at most k.

Constraints:

  • 1≤m=1 \leq m = grid.length ≤103\leq 10^3

  • 1≤n=1 \leq n = grid[i].length ≤103\leq 10^3

  • 1≤1 \leq grid[i][j] ≤109\leq 10^9

  • 1≤1 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Sorted Submatrices With Maximum Element at Most K

Try to solve the Find Sorted Submatrices With Maximum Element at Most K problem.

Statement

You are given an m×nm \times n integer matrix grid and an integer k.

A submatrix is considered sorted if every row within it is sorted in non increasing order.

Return the number of sorted submatrices such that the maximum element in the submatrix is at most k.

Constraints:

  • 1≤m=1 \leq m = grid.length ≤103\leq 10^3

  • 1≤n=1 \leq n = grid[i].length ≤103\leq 10^3

  • 1≤1 \leq grid[i][j] ≤109\leq 10^9

  • 1≤1 \leq k ≤109\leq 10^9