Tap here to switch tabs
Problem
Submissions

Problem: Maximum Strictly Increasing Cells in a Matrix

Try to solve the Maximum Strictly Increasing Cells in a Matrix problem.

Statement

Given an m $ imes$ n integer matrix mat, you can choose any cell in the matrix as your starting point.

From a cell (r, c), you can move to any other cell located in the same row or column, provided that the value in the destination cell is strictly greater than mat[r][c].

Return the maximum number of cells that can be visited along a valid path.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤105\leq 10^5

  • 1≤1 \leq m $ imes$ n ≤105\leq 10^5

  • −105≤-10^5 \leq mat[i][j] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Strictly Increasing Cells in a Matrix

Try to solve the Maximum Strictly Increasing Cells in a Matrix problem.

Statement

Given an m $ imes$ n integer matrix mat, you can choose any cell in the matrix as your starting point.

From a cell (r, c), you can move to any other cell located in the same row or column, provided that the value in the destination cell is strictly greater than mat[r][c].

Return the maximum number of cells that can be visited along a valid path.

Constraints:

  • m == mat.length

  • n == mat[i].length

  • 1≤1 \leq m, n ≤105\leq 10^5

  • 1≤1 \leq m $ imes$ n ≤105\leq 10^5

  • −105≤-10^5 \leq mat[i][j] ≤105\leq 10^5