FastPrepFastPrep
Problem Brief

Increasing Paths, part 1

OA

There is a two-dimensional grid at most 15x15. Each space has an integer value between 0 and 65535, inclusive.

A path is a sequence of two or more spaces for which each space is horizontally or vertically adjacent to the previous space.

An increasing path is a path in which each space has a greater value than the previous space.

Below is an example of an increasing path:

Write a program to determine the number of increasing paths in a grid. Paths whose spaces have the same value but different locations are distinct.

There are at most 2,000 increasing paths in the grid.

1Example 1

Input
grid = [[5], [1], [2, 7]]
Output
4
Explanation
Example 1 illustration

There are 4 increasing paths. Those paths are:

1 → 5
1 → 7
2 → 5
2 → 7

Constraints

Limits and guarantees your solution can rely on.

🥑
public int countIncreasingPaths(int[][] grid) {
  // write your code here
}
Input

grid

[[5], [1], [2, 7]]

Output

4

Sign in to submit your solution.