Given a grid of integers, return the number of strictly increasing paths, where each move can go up, down, left, or right and every step must move to a strictly larger value. Pattern focus: Grid path counting. Use DFS with memoization or topological DP over cell values.
grid is a matrix of integers
number of strictly increasing paths
Example 1:
Input:
grid = [[1,1],[3,4]]
Output:
8
Explanation:
There are 8 strictly increasing paths.
Example 2:
Input:
grid = [[3,1],[2,4]]
Output:
8
Explanation:
This grid also has 8 increasing paths.
Example 3:
Input:
grid = [[1]]
Output:
1
Explanation:
A single cell contributes one path.