FastPrepIncreasing Paths, part 2
Problems/Increasing Paths, part 2

Increasing Paths, part 2

Hudson River Trading logoHudson River Trading● HardOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

This is the same problem as before, except that there may be many more increasing paths, up to 20 billion. (Note this result will not fit in a 32-bit integer.)

Function

countIncreasingPaths(matrix: int[][]) → long

Examples

Example 1

matrix = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21], [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]]return = 601079908

There are 601,079,908 increasing paths.

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

  • Cherry PickupInfosys · OAInfosys interview questions
  • Safest Shortest Path Through a GridSnowflake · OASnowflake interview questions
  • Minimum Cost Path with TeleportationsAmazon · OA
  • Minimum Starting Health in a GridIntuit · OAIntuit interview questions
  • Largest Two Non-Overlapping Buildable SquaresAmerican Express · OAAmerican Express interview questions
  • Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
  • Empty ShelfSquarepoint Capital · OASquarepoint Capital interview questions
  • Timed Coin Collection in a 2×N GridAtlassian · OAAtlassian interview questions
  • Maximum Sum RectangleDeloitte · OADeloitte interview questions
  • Longest Increasing Path in a MatrixNutanix · OANutanix interview questions

Hudson River Trading interview experiences

  • Hudson River Trading Data Science Interviews: 2 Experiences
  • Hudson River Trading interviews · 2021
  • Hudson River Trading OA · 2021
  • Hudson River Trading interviews · 2022
  • Hudson River Trading OA · 2022
  • Hudson River Trading interviews · 2023
All Hudson River Trading interview questionsSee Hudson River Trading hiring insights
Saved
class Solution {
    public long countIncreasingPaths(int[][] matrix) {
      // write your code here
    }

}
Checking account…