Tap here to switch tabs
Problem
Submissions

Problem: Number of Increasing Paths in a Grid

med
30 min
Try to solve the Number of Increasing Paths in a Grid problem.

Statement

You are given an m $ imes$ n integer matrix grid. You can start at any cell and move to any of its 44 adjacent cells (up, down, left, right).

Return the total number of strictly increasing paths in grid. Since the answer can be very large, return it modulo 109+710^9 + 7.

Two paths are considered distinct if they visit a different sequence of cells.

Constraints:

  • m == grid.length

  • n == grid[i].length

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

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

  • 1≤1 \leq grid[i][j] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Increasing Paths in a Grid

med
30 min
Try to solve the Number of Increasing Paths in a Grid problem.

Statement

You are given an m $ imes$ n integer matrix grid. You can start at any cell and move to any of its 44 adjacent cells (up, down, left, right).

Return the total number of strictly increasing paths in grid. Since the answer can be very large, return it modulo 109+710^9 + 7.

Two paths are considered distinct if they visit a different sequence of cells.

Constraints:

  • m == grid.length

  • n == grid[i].length

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

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

  • 1≤1 \leq grid[i][j] ≤105\leq 10^5