Example with an obstacle
Input
unique_paths_with_obstacles([[0,0,0],[0,1,0],[0,0,0]])
Output
2
There are two paths that avoid the obstacle at (1,1).
Full lesson preview
Compute number of unique paths from top-left to bottom-right in a grid with obstacles using DP.
Problem statement
Task
Examples
Input
unique_paths_with_obstacles([[0,0,0],[0,1,0],[0,0,0]])
Output
2
There are two paths that avoid the obstacle at (1,1).
Input format
Output format
Constraints
Samples
Input
[[0,1],[0,0]]
Output
1
Only one path: down then right.