Back to problems

Grid Path Count with Diagonal Moves and Checkpoints

Algorithm · Google · Medium

Requirements You are given a matrix with n rows and m columns. A path begins in the bottom-left cell (n-1, 0) and must finish in the bottom-right cell (n-1, m-1). From a cell (r, c) you may step to any of these three cells, as long as it stays inside the matrix: up-right: (r-1, c+1) right: (r, c+1) down-right: (r+1, c+1) Return the total number of distinct paths from the start cell to the end cell. Examples Example 1 Example 2 Follow-ups Follow-up 1: The matrix also contains…

Loading the rest of the question…