Grid Unique Paths

DYNAMIC PROGRAMMING
MATRIX

Problem

Given a grid of size m x n, where each cell can either be an obstacle 1 or a free space 0, determine the number of unique paths from the top-left corner to the bottom-right corner. You can only move down or right at any step, and you cannot move through cells containing obstacles.

Examples

countPaths([ [0, 0, 0], [1, 1, 0], [0, 0, 0] ]) // returns 1 // There are only one path: // - Right -> Right -> Down -> Down
Loading...
0
0
0
0
1
1
0
0
0