Increasing Paths, part 1
Updated
Problem statement
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.
Function
countIncreasingPaths(grid: int[][]) → intExamples
Example 1
grid = [[5, 1], [2, 7]]return = 4There are four increasing paths: 1 → 5, 1 → 7, 2 → 5, and 2 → 7.
Constraints
🥑
More Hudson River Trading interview questions
- Format a Signed Integer with CommasPHONE SCREEN · Seen Nov 2026
- Order and Batch Open-Close LifecyclePHONE SCREEN · Seen Nov 2026
- Count Palindrome Addition ChoicesOA · Seen Nov 2026
- Tilting Maze BallPHONE SCREEN · Seen Oct 2026
- Count Multiples of Three with Two SevensOA · Seen Oct 2026
- Recursively Expanded Shell Command CountsOA · Seen Oct 2026
- Rotate Matrix Regions Around the DiagonalsOA · Seen Oct 2026
- Maximum Diamond SumOA · Seen Oct 2026
- Smallest Most-Lit Street PositionOA · Seen Oct 2026
- Rearrange String by Alternating EndsOA · Seen Sep 2026
Similar questions at other companies
- Word SearchBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Minimum Cleaning Robot RunsHSBC · OAHSBC interview questions
- Count Islands with DFS and BFSVisa · OAVisa interview questions
- Number of IslandsGoldman Sachs · OA · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
- House Bounds in a Ragged GridRippling · OA · PHONE SCREENRippling interview questions
- Maximum Damage PatchGecko Robotics · OA · PHONE SCREEN
- Rat in a Maze: All Simple PathsPeopleStrong · OAPeopleStrong interview questions
- Find a Word Path Moving Right or DownIntuit · OAIntuit interview questions
- Cave AdvantureMeta · OAMeta interview questions
- Replacing Val 🍓Two Sigma · OATwo Sigma interview questions